Suppose I have a junit
custom class loader, which reads the test data from a text file and create and run tests in runtime. The runner uses no test class.
Now I would like to run it with surefire
maven plugin. That is, I would like to specify the runner as a parameter of the the surefire
plugin "execution" in the pom.xml
.
Can I do that?
No. As far as I know, there is no way of specifying a Runner
class in the maven-surefire-plugin. However, you should be able to create a single Test-Class and use the @RunWith(YourRunner.class)
to let it run with your custom runner.
I think that is because the intended use case for Runner
s is on a per-test basis, not on a project-level. You can have a project with mixed uses of various Runners, e.g. some are Spring-based, some are concurrent, some run with JUnit3, some with JUnit4 etc.