- Selenium Framework Design in Data-Driven Testing
- Carl Cocchiaro
- 138字
- 2025-02-18 04:59:04
The TestNG Listener class
In order to provide test results to the IDE console, or to a log file, users must build a test listener class into their framework. There are many open source classes available for use, as well as a TestNG class called TestListenerAdapter, which can be extended to provide custom logging information in real time. In other words, users can get results while the tests are running by logging them to the console, or by logging the data to a file.
The JavaDoc for the TestNG's TestListenerAdapter class is located at https://jitpack.io/com/github/cbeust/testng/master-6.12-gf77788e-171/javadoc/org/testng/TestListenerAdapter.html.
How do you use it? How does it keep track of all the test results while the suite of tests are running? How does it get automatically called in a Selenium Framework Test Suite run? These questions will be answered in this section.