Determining junit4 vs junit5

I am having trouble with understanding how TestObject (for junit) determines which version of junit to use and would really appreciate some help.

When I execute from a specific Test class (or a specific test), the call to 

this.getRunnerInner()

returns junit4 (which is correct) and all my junit tests are found and executed.

However, when I execute from a package (or module), the call returns junit5 (as opposed to null...i think) which (again, I think) causes no tests to be found.

How can I force the executions of a package (or module) to always be junit4?  I have registered my own RunConfigurationExtension and implemented 

updateJavaParameters

but as far I can tell, the junit version is determined via the TestObject class (which sets myRunner) and I have no control over this attribute.

Basically, I am trying to understand how this code works:

return !JUnitUtil.isJUnit5(globalSearchScope, project) && !this.isCustomJUnit5(globalSearchScope) ? null : "-junit5";
0
1 comment

Hi Mark,

the idea is that junit 5 can run junit 4 tests and if junit 5 is found on the classpath, then it should be used instead of junit 4 (as junit 4 won't be able to run junit 5 tests). Does it help?

Anna

0

Please sign in to leave a comment.