Intercept JUnit Jupiter Test (beforeEach, afterEach etc.) for an JUnit Jupiter Extension

Answered

I'm developing an JUnit Jupiter Extension which is intended to run integration tests for Maven plugins. If you like to execute a single integration test there have to be done some preparation steps before the real integration can be executed. Those preparation steps are done via a maven plugin while executing on plain command line. 

Those preparation steps comprise of compiling code of the plugin code under test which should being tested (usually done by the normal Maven build); copying the resulting artifacts including their dependencies to a particular location (needed to execute the integration tests) and maybe more...

The question is now: Can I intercept the parts before a test is executed, after etc. (like beforeAll, beforeEach, AfterEach, AfterAll of JUnit Jupiter) inside the IDE while executing a test ?

 

My assumption is that for that purpose a plugin for IDEA IntelliJ is needed?

 

 

0
1 comment

Sorry this got lost. You can register custom implementation of com.intellij.rt.execution.junit.IDEAJUnitListener/com.intellij.rt.execution.junit.IDEAJUnitListenerEx in com.intellij.junitListener extension point.

See com.intellij.junit4.JUnitTestDiscoveryListener as reference.

0

Please sign in to leave a comment.