Reputation: 613
I've come up with a concept for a TestNG listener that would be beneficial to my needs.
I basically want to create my own listener that will create a report using a sample HTML report.
My idea is that the listener like all others will be declared in the XML.
However I want my listener to look at the XML and look at how many classes are declared and know how many tests classes are to be executed.
I can then in my report show a progress bar of the amount of Test Classes that are too be executed, then in turn providing a live feed of the progress of the tests classes.
An example would be if in my XML I have 5 tests classes declared and in the HTML report it shows a progress bar showing 0 out of 5.
As the tests are run and finished the progress bar will update showing real time progress of the tests being executed.
Is this idea feasible/possible with TestNG? Would I be able to create my own Listener to do what I want to achieve?
Any articles/advice to get me on the right path would be beneficial.
EDIT: Might not have asked the question the best way possible, so any criticism or edit suggestions will be appreciated.
Upvotes: 1
Views: 254
Reputation: 5740
I don't see how it is possible if you expect the listener generate the report because HTML is something static by definition. And it could be hard to add nodes a the right place.
What it could be possible is having your ITestListener which runs an http server and exposes data via REST. Then you'll have your html with some javascript pooling the rest service to check progress of the suite test.
Upvotes: 2