Skip to content

Commit 145727a

Browse files
committed
Update Readme.md
1 parent df440c4 commit 145727a

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

Readme.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,63 @@ See [here](http://extentreports.com/docs/versions/4/java/testng.html) for comple
88

99
See the [Listeners](http://extentreports.com/docs/versions/4/java/testng.html#listeners) section for usage instructions.
1010

11+
### Examples
12+
13+
An example project is available [here](https://github.com/extent-framework/examples/tree/master/extentreports-testng-adapter-example) to understand the usage.
14+
15+
Note: when using this adapter, you are not required to add any code in your project. The adapter works for you to generate the report, perform auto-configuration through the configuration file, and you can also enable/disable reporters from the properties file.
16+
17+
See [this](https://github.com/extent-framework/examples/blob/master/extentreports-testng-adapter-example/src/test/java/com/aventstack/extentreports/adapter/testng/tests/SimpleAssertTests.java) example of how a test is created, marked with the listener. Note: a good approach is to mark a common base class with the `@Listener` only once.
18+
19+
```
20+
import com.aventstack.extentreports.testng.listener.ExtentITestListenerClassAdapter;
21+
22+
@Listeners({ExtentITestListenerClassAdapter.class})
23+
public class SimpleAssertTests {
24+
25+
@Test
26+
public void passTest() {
27+
Assert.assertTrue(true);
28+
}
29+
30+
@Test
31+
public void failTest() {
32+
Assert.assertTrue(false);
33+
}
34+
35+
}
36+
```
37+
38+
Configuration can be added under `src/test/resources` as shown [here](https://github.com/extent-framework/examples/tree/master/extentreports-testng-adapter-example/src/test/resources). Note the contents of `extent.properties` which can be used to enable/disable reporters, set path to the configuration file, and also to output to a desired location.
39+
40+
```
41+
extent.reporter.avent.start=false
42+
extent.reporter.bdd.start=false
43+
extent.reporter.cards.start=false
44+
extent.reporter.email.start=false
45+
extent.reporter.html.start=true
46+
extent.reporter.klov.start=false
47+
extent.reporter.logger.start=false
48+
extent.reporter.tabular.start=false
49+
50+
extent.reporter.avent.config=
51+
extent.reporter.bdd.config=
52+
extent.reporter.cards.config=
53+
extent.reporter.email.config=
54+
extent.reporter.html.config=src/test/resources/html-config.xml
55+
extent.reporter.klov.config=
56+
extent.reporter.logger.config=
57+
extent.reporter.tabular.config=
58+
59+
extent.reporter.avent.out=test-output/AventReport/
60+
extent.reporter.bdd.out=test-output/BddReport/
61+
extent.reporter.cards.out=test-output/CardsReport/
62+
extent.reporter.email.out=test-output/EmailReport/ExtentEmail.html
63+
extent.reporter.html.out=test-output/HtmlReport/ExtentHtml.html
64+
extent.reporter.logger.out=test-output/LoggerReport/
65+
extent.reporter.tabular.out=test-output/TabularReport/
66+
```
67+
1168
### License
1269

1370
extentreports-testng-adapter is MIT licensed.

0 commit comments

Comments
 (0)