Test Execution Listener

"janpridal" <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <[email protected]>
Hi markiewb, Milos,
thank you for your replies. I took a look at netbeans-continuous-surefire but the granularity of events is too rough - it just reacts to Maven surefire mojo execution but there's no possibility (at least I could not find it) to register for executions of specific test cases.

To be able to react to test population into a results window is not enough in my case as I need to notify about test case executions in real time - for example if the JUnit tests are making some REST calls I need to know which calls belong to which test case.

I need to notify the external system of every test case executed in NetBeans - so it would be very nice if I could register an instance of JUnit  RunListener somewhere and receive the notifications

https://github.com/junit-team/junit/blob/master/src/main/java/org/junit/runner/notification/RunListener.java

If NetBeans execute JUnit tests in Maven project via Surefire or Failsafe plugin I can register the listener in plugin configuration inside POM as described in section Using Custom Listeners and Reporters:

https://maven.apache.org/surefire/maven-failsafe-plugin/examples/junit.html

Though that is a way I can take it requires POM modification. If I could plug in such listener using NetBeans API even for Maven builds it would be better.

Where I am totally lost is how to do it in case the NetBeans execute JUnit test directly for non-Maven based projects. Still I need to receive notifications upon test case start and finish.

For example in Eclipse I am able to use extension point in JDT UI and register a test listener that gets notified when a JUnit test is executed by Eclipse JUnit test runner RemoteTestRunner:

http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Fguide%2Fjdt_api_junit.htm&cp=3_0_3_0

So the question is again - is there something similar in NetBeans?

-Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.