I want to know is any other option available to generate test report except TestNG framework in selenium webdriver
Asked
Active
Viewed 1.1k times
1
-
Selenium is just a driver to manage a browser so in fact, it have nothing to do with testing. So, you could use any test reporting technique you want to. Like this: http://earlwillis.wordpress.com/2012/01/31/getting-started-with-junit-reports/ or this http://stackoverflow.com/questions/8084773/junit-test-report-enrichment-with-javadoc – Morvader Sep 16 '14 at 07:29
-
You wouldn't happen to know of an alternative for Visual Studio and C#? – Frank H. Sep 17 '14 at 19:41
-
Frank - ExtentReports is now also available for .NET. Link: http://relevantcodes.com/extentreports-for-selenium/. If you're looking to convert your report from NUnit, you can use ReportUnit: http://relevantcodes.com/reportunit-report-generator/. – Anshoo Jul 14 '15 at 15:07
2 Answers
4
You can try ExtentReports: http://extentreports.com. An example:
public class Main {
public static void main(String[] args) {
// start reporters
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("extent.html");
// create ExtentReports and attach reporter(s)
ExtentReports extent = new ExtentReports();
extent.attachReporter(htmlReporter);
// creates a toggle for the given test, adds all log events under it
ExtentTest test = extent.createTest("MyFirstTest", "Sample description");
// log(Status, details)
test.log(Status.INFO, "This step shows usage of log(status, details)");
// info(details)
test.info("This step shows usage of info(details)");
// log with snapshot
test.fail("details", MediaEntityBuilder.createScreenCaptureFromPath("screenshot.png").build());
// test with snapshot
test.addScreenCaptureFromPath("screenshot.png");
// calling flush writes everything to the log file
extent.flush();
}
}

Anshoo
- 725
- 5
- 10