maven not finding a test

Fri, Jul 13, 2012

Sometimes it’s easy to get carried away with annotations and when something doesn’t work you endlessly scratch your head. I’ve just extended MatrixClient to talk SSL to an ActiveMQ broker that wants client authentication and added the appropriate test:

public class MQClientTestSSL extends ClientTest … {
  @Test
  public void test() {
but Maven wasn’t running the test. I could run it manually:
mvn test -Dtest=uk.ac.uhi.it.matrix.client.MQClientTestSSL
but mvn clean install didn’t run the test. According to the surefire documentation it’s meant to run tests with a pattern ‘Test*.java’ but it clearly wasn’t. The only way to get the test to run was to rename it:
public class MQClientSSLTest extends ClientTest … {
and Maven then picked it up and ran it.

comments powered by Disqus