I am new to testing, need to report testing results using extentreports,
below is the code for testing:
public ExtentReports reports;
public ExtentTest logger;
public ModelTests() {
reports = new ExtentReports("acceptanceTest\\reports\\Report.html");
}
@Test
public void searchModelTest() throws JSONException, URISyntaxException {
JSONObject jsonResponse = searchModel();
logger = reports.startTest("Test");
logger.log(LogStatus.PASS, "Success");
assertEquals("SOLAR SLEEVE 2014", jsonResponse.getString("modelName"));
logger.log(LogStatus.FAIL, "Failure");
reports.endTest(logger);
}
I do not see any report getting generated.
Will extentreport work with jersey framework, I have seen selenium examples.
Help will be appreciated.
Here is a checklist that you should follow:
Create a new instance of ExtentReports.
ExtentReports extent = new ExtentReports(file-path, replaceExisting);
Name and describe the instance via the startTest method. Keep in mind, you are now creating a new instance of ExtentTest.
ExtentTest test = extent.startTest("Test Name", "Sample description");
Log your results against your ExtentTest instance.
test.log(LogStatus.PASS, "Step details");
End your test.
extent.endTest(test);
Finally write everything to your document
extent.flush();
Also, here is the documentation specifically for those implementing via Maven.
ExtentReports | Maven Documentation
...