I created JUnit
-tests for my Fitnesse testcases:
import org.junit.runner.RunWith;
import fitnesse.junit.FitNesseRunner;
@RunWith(FitNesseRunner.class)
@FitNesseRunner.Suite("mysuite")
@FitNesseRunner.FitnesseDir(".")
@FitNesseRunner.OutputDir("./target/fitnesse-results")
public class RunFitnesseTestMySuite {
}
Now I can execute this test like a normal JUnit
testcase in Eclipse.
However, maven
completly ignores this test. All my other JUnit
s are executed by maven but not this particular Fitnesse
test.
This seems strange to me because @RunWith
is a normal JUnit
annotation and so I would expect maven to also run these tests.
Any ideas?
You probably have not configured surefire to run tests with a non-default name. Your test class does not match surefire's defaults and therefore will only be run if you configure the tests to run explicitly. From surefire documentation:
By default, the Surefire Plugin will automatically include all test classes with the following wildcard patterns:
- "**/Test*.java" - includes all of its subdirectories and all Java filenames that start with "Test".
- "**/*Test.java" - includes all of its subdirectories and all Java filenames that end with "Test".
- "**/*Tests.java" - includes all of its subdirectories and all Java filenames that end with "Tests".
- "**/*TestCase.java" - includes all of its subdirectories and all Java filenames that end with "TestCase".
If the test classes do not follow any of these naming conventions, then configure Surefire Plugin and specify the tests you want to include.
In your case I expect you want to use something like:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<includes>
<include>**/*Suite.java</include>
</includes>
</configuration>
</plugin>