N-Reporter is a JAVA based API report generator that empowers you to generate beautiful, interactive and detailed results reports for automation tests. It allows you to keep track of execution tests and over time. N-Reporter can include screenshots, code blocks, tags, specified author and categorized the execution and any other relevant information many more information can be added dynamically. See Screenshot below:
###Pre-requisites N-Reporter was build on Java 8. So you will need to download and install Java 8
Insert snippet below into your pom.xml and build your project.
<dependency>
<groupId>com.inspiredtesting</groupId>
<artifactId>Inspired-Report</artifactId>
<version>${reporter.verison}</version>
</dependency>
Replace x.x.x by version number. Find latest Release
- Generate beautiful HTML report.
- Customizable report content.
- Customizable report name.
- Customizable project name.
- Categories execution (Regression execution etc).
- Include tags in tests executed.
- Customizable status color for your report.
- Mobile responsive report.
- Include Dashboard with graphs.
- Convert Media content into base64 imaging.
To enable a report or start a reporter, create an object of NReporter
NReporter report = new NReporter(“folderPath”);
To create a test use createTest
method. This will return an NTest object.
NTest test = report.createTest("First Test", "First Steps description");
Create portable (base64 Image) media content from either URL or physical file path:
// Using Path
MediaContent.createMediaFromPath("./src/main/resources/NReporter2.png").toBase64();
// Using URL
MediaContent.createMediaFromURL("https://www.inspiredtesting.com/images/logo.png").toBase64();
Define your project name
report.setProjectName("ProjectName");
Define report name. (if null will use project name)
report.setReportName("ReportName");
Categorize your execution (Optional)
test.setCategory("Category Name");
// Short-hand
report.setCategory(new InspiredCategory("Category Name", "Category Description"));
Add extra information regarding the execution environment.
report.setSystemInfo("Java Version", "1.8");
Customize status background colours for HTML report. Use setStatusColor
method.
// With RGB value
report.setStatusColor(Enums.Status.FATAL, "rgb(255, 0, 0)");
// With Hex value
report.setStatusColor(Enums.Status.INFO, "#09a2ef");
To add screenshot to your last test result, use addScreenshot
. This will return an NTest object.
test.addScreenshot("https:dummyimage.com/600x400/000/fff.png&text=Passed");
test.assignTag("tag", "tag2");
Calling the flush method will write update of your execution into a HTML report.
report.flush();
public void basicReport() throws Exception {
// Initialiaze reporting
NReporter report = new NReporter("/path/to/report/folder");
// Set Report logo
report.setLogo("logoName");
// Set Report name
report.setReportName("NReportering Name");
// Set Project Name
report.setProjectName("NReporter Project");
// Create New test
NTest test = report.createTest("Test Name", "Test description");
test.pass("First Step Passed");
test.addScreenshot("https://dummyimage.com/600x400/000/fff.png&text=first passed Shot");
test.skip("First Step Failed");
test.addScreenshot("https://dummyimage.com/600x400/000/fff.png&text=first Failed Shot");
test.pass("First Step Debug", "https://dummyimage.com/600x400/000/fff.png&text=debug Pic");
}
NB: Report is generated as you log your event
public void reportWithJSON() throws Exception {
// Initialiaze reporting
NReporter report = new NReporter("/path/to/report/folder");
// Set Report logo
report.setLogo("path");
// Set Report name
report.setReportName("NReportering Name");
// Set Project Name
report.setProjectName("NReporter Project");
// Create Report
report.createReportFromJson("/path/to/json/file");
}
- Boostrap 4
- Freemaker Apache
- Google Gson
- Unirest
- Commons-codec
- Commons-io
- Commons-logging
- Joda-time
- log4j
- JUnit5
- Nelson Dick - Author & Developer
This project is licensed under the Inspired Testing License - see the LICENSE.md file for more details.