{"id":20548297,"url":"https://github.com/email2vimalraj/testngextentsreport","last_synced_at":"2025-04-14T10:53:11.898Z","repository":{"id":57729440,"uuid":"70661414","full_name":"email2vimalraj/TestNGExtentsReport","owner":"email2vimalraj","description":"TestNG Extents Report","archived":false,"fork":false,"pushed_at":"2023-04-17T14:34:16.000Z","size":29,"stargazers_count":38,"open_issues_count":10,"forks_count":29,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T00:07:15.558Z","etag":null,"topics":["extent-report","extentreports","java","test-runner","testng","testng-suite"],"latest_commit_sha":null,"homepage":"http://vimalselvam.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/email2vimalraj.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-12T04:05:53.000Z","updated_at":"2024-12-06T04:41:49.000Z","dependencies_parsed_at":"2024-11-16T02:13:00.342Z","dependency_job_id":"3b49fb27-b74e-4323-8755-dfcc85ec6d09","html_url":"https://github.com/email2vimalraj/TestNGExtentsReport","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/email2vimalraj%2FTestNGExtentsReport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/email2vimalraj%2FTestNGExtentsReport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/email2vimalraj%2FTestNGExtentsReport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/email2vimalraj%2FTestNGExtentsReport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/email2vimalraj","download_url":"https://codeload.github.com/email2vimalraj/TestNGExtentsReport/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248868778,"owners_count":21174756,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["extent-report","extentreports","java","test-runner","testng","testng-suite"],"created_at":"2024-11-16T02:12:55.095Z","updated_at":"2025-04-14T10:53:11.873Z","avatar_url":"https://github.com/email2vimalraj.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TestNG Extents Report\nThe TestNG Extents report is a listener plugin which you can add it as a listener to your testng suite to generate a nice Extent report.\n\nThis listener uses the [ExtentReports v3.0.0](http://extentreports.relevantcodes.com/), a library developed by Anshoo Arora for reporting.\n\n## Build Status\n[![Build Status](https://travis-ci.org/email2vimalraj/TestNGExtentsReport.svg?branch=master)](https://travis-ci.org/email2vimalraj/TestNGExtentsReport)\n\n## Why another library?\nYou don't have to spend time in re-inventing on how to define what. Just add this as a listener or [service loader](http://testng.org/doc/documentation-main.html#listeners-service-loader). You will get the nice looking report generated at the end of your test execution.\n\nAlso, you will get the **emailable report** out-of-the box.\n\n## Pre-requisite\n- JDK 8+\n- Extent Report v3.0.2+\n\n## Usage\nFor maven, add the following as dependency:\n\n```\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.vimalselvam\u003c/groupId\u003e\n    \u003cartifactId\u003etestng-extentsreport\u003c/artifactId\u003e\n    \u003cversion\u003e1.3.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nEither in your **testng.xml**, add the listener:\n\n```\n\u003clisteners\u003e\n    \u003clistener class-name=\"com.vimalselvam.testng.listener.ExtentTestNgFormatter\" /\u003e\n\u003c/listeners\u003e\n```\n\nor add as a [service loader](http://testng.org/doc/documentation-main.html#listeners-service-loader) (recommended).\n\nBy default, the report will be generated at TestNG's output directory. i.e., `test-output/report.html` and the emailable report at `test-output/emailable-report.html`.\n\nIn case you want to generate the report in a different location, make sure you pass the JVM argument called `reportPath` with the absolute directory path.\n\n*For example*: I run my maven test as: `mvn clean test -DreportPath=output`. This will generate both the reports in the `${project directory}/output`.\n\n### Adding custom reporter config\nYou can customize the report using a XML file. The XML file should follow as given here: [ExtentReports Configuration](http://extentreports.relevantcodes.com/java/#configuration).\n\nThe XML file should be referred as parameter in your suite xml. The parameter name should be `report.config`.\nFor instance, the parameter in the suite xml should be as follows:\n\n```xml\n\u003cparameter name=\"report.config\" value=\"src/test/resources/extent-config.xml\" /\u003e\n```\n\nThe value should be the config XML file path.\n\n### Adding System Information\nIn case you want to add system information, you will have to implement an interface `com.vimalselvam.testng.SystemInfo`. This interface contains a method with return type as `Map\u003cString, String\u003e`.\nConstruct your system information with the map and return that map. After you have implemented, the custom implementation should be referred in your TestNG Suite xml as a parameter at the suite level.\n\nFor instance add the following parameter at your suite level in the TestNG suite xml:\n\n```xml\n\u003cparameter name=\"system.info\" value=\"test.MySystemInfo\" /\u003e\n```\n\nThe parameter name should be `system.info` and the value should be your fully qualified custom implementation class name.\nFor example my custom implementation look like this:\n\n```java\npackage test;\n\nimport com.vimalselvam.testng.SystemInfo;\nimport org.testng.collections.Maps;\n\nimport java.util.Map;\n\n/**\n * This is a small utility class to prepare the system information\n */\npublic class MySystemInfo implements SystemInfo {\n    @Override\n    public Map\u003cString, String\u003e getSystemInfo() {\n        Map\u003cString, String\u003e systemInfo = Maps.newHashMap();\n        systemInfo.put(\"Test Env\", \"QA\");\n        systemInfo.put(\"Browser\", \"firefox\");\n        return systemInfo;\n    }\n}\n```\n\n### Instance of the Listener\nAt any point in time, you can get the instance of the listener as `ExtentTestNgFormatter.getInstance()`\n\n### Adding Screenshot\nTo add the screenshot, you have two options.\n* If the screenshot can be added from the test method, then\n\n```java\nExtentTestNgFormatter.getInstance().addScreenCaptureFromPath(filePath);\n```\n\n* If the screenshot can be added from the configuration method, then for example:\n```java\n@AfterMethod\npublic void afterMethod(ITestResult iTestResult) throws IOException {\n    // The ITestResult is a mandatory parameter\n    ExtentTestNgFormatter.getInstance().addScreenCaptureFromPath(iTestResult, filePath);\n}\n```\n\n### Adding info log\nIf any case, you want to attach the `info` log on your test method, you simply call TestNg's `Reporter.log` method which will be added to your test log. For example:\n\n```java\n@Test\npublic void testMethod() {\n    Reporter.log(\"Custom log\");\n}\n```\n\n### Adding test runner output\nTo add the test runner output, simply call from anywhere:\n\n```java\nExtentTestNgFormatter.getInstance().setTestRunnerOutput(\"My output\");\n```\n\n### Adding new node\nSometimes you may have to add new node under your test. This situation arises when you have iteration in the test method and considering each iteration as a separate node in the report.\nThis could be solved by using `addNewNodeToTest()` method.\n\nRefer [DemoTestClass](src/test/java/test/DemoTestClass.java) on how to add new nodes and in case of failure, how to fail the added node.\n\n## Cucumber?\nRefer my another library which generates the same report for the cucumber based BDD tests: [CucumberExtentReporter](https://github.com/email2vimalraj/CucumberExtentReporter)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femail2vimalraj%2Ftestngextentsreport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femail2vimalraj%2Ftestngextentsreport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femail2vimalraj%2Ftestngextentsreport/lists"}