package com.inmar.project.testcases;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import com.inmar.project.basePackage.Base;
import com.relevantcodes.extentreports.LogStatus;
public class Login extends Base{
@Test
public void loginTest()
{
test=rep.startTest("Login");
test.log(LogStatus.INFO, " Starting the Test-- Login");
init();
openBrowser();
test.log(LogStatus.INFO, "Browser Opened");
naviagte(prop.getProperty("appurl"));
alert();
test.log(LogStatus.INFO, "Navigated to the URL");
doLogin("username_name","password_name");
test.log(LogStatus.INFO, "Login Successfull");
readText("homepageText_xpath",prop.getProperty("homepageText"));
}
@AfterMethod
public void quit()
{
rep.endTest(test);
rep.flush();
}
}
-------------------------------------------------------------------------------
In the above program, Exception is thrown at the step "alert();". Console shows the exception :"org.openqa.selenium.NoSuchElementException: no such element"
But Extent Report show the test status as Pass.
Here in the above program, we have few more steps to be executed but program stopped accidentally but still the report shows the test cases is Pass.
Please let me know how to fail a test case in Extent Report when the program (test case) stopped unexpectedly.
Thanks,
Kannan C
How do I fail the test cases, if it is not fully run.