Questions tagged [surefire]

The Surefire Maven Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application. It is commonly used in continuous integration.

The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application. It generates reports in two different file formats:

Plain text files (.txt)
XML files (
.xml)

By default, these files are generated at ${basedir}/target/surefire-reports.

The Surefire Plugin has only one goal:

surefire:test

runs the unit tests of an application.

Related tags :

278 questions
205
votes
10 answers

How do I get my Maven Integration tests to run

I have a maven2 multi-module project and in each of my child modules I have JUnit tests that are named Test.java and Integration.java for unit tests and integration tests respectively. When I execute: mvn test all of the JUnit tests *Test.java…
Peter Delaney
  • 5,278
  • 9
  • 33
  • 40
122
votes
19 answers

JUnit tests pass in Eclipse but fail in Maven Surefire

I have written some JUnit tests using JUnit 4 and spring-test libraries. When I run the tests inside Eclipse then run fine and pass. But when I run them using Maven (during the build process), they fail giving a spring related error. I am not sure…
Abhinav Sarkar
  • 23,534
  • 11
  • 81
  • 97
84
votes
6 answers

Is there a way to skip only a single test in maven?

I would like to skip only a single test while launching mvn install. Is there a way to do that ?
paulgreg
  • 18,493
  • 18
  • 46
  • 56
79
votes
6 answers

How to get a test resource file?

In a unit test I need to import a csv file. This is located in the resources folder, i.e. src/test/resources
simpatico
  • 10,709
  • 20
  • 81
  • 126
62
votes
8 answers

Is there a way to "fail fast" for junit with the maven surefire plugin?

I'm currently working on a java project using maven. We use the maven surefire plugin to run our junit suite as part of the build process. Our test suite is rapidly growing, in both coverage and execution time. The execution time is very…
Eliza Brock Marcum
  • 1,570
  • 1
  • 14
  • 25
52
votes
1 answer

TypeNotPresentExceptionProxy

When upgrading from Surefire 2.6 to Surefire 2.13, I get a TypeNotPresentExceptionProxy when running my unit tests. java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy at…
gangsta
  • 837
  • 2
  • 7
  • 10
49
votes
8 answers

Is there a decent HTML Junit report plugin for Maven?

I find the surefire-report plug-in very unsuitable to my working style. I clean the project all the time and I don't want to spend 5 min to rebuild the whole site every time I want to look at the test report in my browser. If I type mvn…
Y.H Wong
  • 7,151
  • 3
  • 33
  • 35
46
votes
13 answers

Surefire is not picking up Junit 4 tests

For some reason I cannot get Maven 2 Surefire plugin to execute JUnit 4 test class. public class SimpleTest { @org.junit.Test public void simple() { System.out.println("foo"); } } However if I change this class to be JUnit-3 like, such…
mindas
  • 26,463
  • 15
  • 97
  • 154
40
votes
1 answer

Setting timezone for maven unit tests on Java 8

How do I set the timezone for unit tests in maven surefire on Java 8? With Java 7 this used to work with systemPropertyVariables like in the following configuration, but with Java 8 the tests just use the system timezone.
Wouter Coekaerts
  • 9,395
  • 3
  • 31
  • 35
38
votes
3 answers

Maven 2.1.0 not passing on system properties to Java virtual machine

We use the command line to pass on system properties to the Java virtual machine when running our Hudson builds on a Linux box. It used to work quite well in 2.0.9 by since we upgraded to 2.1.0 it has stopped working altogether. The system…
raisercostin
  • 8,777
  • 5
  • 67
  • 76
36
votes
3 answers

Is there a way to tell surefire to skip tests in a certain package?

Something like the following. I would like a way to skip my dao tests in surefire. Trying to avoid overhead of defining Suites. With CI I'd like to have one nightly that runs all tests and another 5 minute poll of SCM that runs only 'fast'…
Eric Winter
  • 960
  • 1
  • 8
  • 17
32
votes
4 answers

Logging level under maven surefire

I'm unable to adjust java logging's logging level. I'm using maven surefire (mvn test), and trying to adjust from the default INFO to e.g. FINEST. I have logging.properties file under src/test/resources/logging.properties after compile, i see under…
Dzhu
  • 4,311
  • 5
  • 36
  • 48
30
votes
6 answers

How to pass java code a parameter from maven for testing

I need to pass on following values … exeEvironment (Test environment) , testGroup (Group in testNG) from Command-Line -> POM -> TestNG -> Test cases. Based on these two posts .... pass a java parameter from maven How to pass parameters to…
Girish
  • 1,981
  • 3
  • 17
  • 18
30
votes
3 answers

Run JUnit Tests contained in dependency jar using Maven Surefire

I have a jar in my maven repository that contains junit tests, which should be run in different projects, because it is able to inspect the project and test for certain features of it. Unforunately surefire doesn't pick up tests that are contained…
devsnd
  • 7,382
  • 3
  • 42
  • 50
28
votes
2 answers

Maven surefire plugin fork mode

By default maven surefile plugin run tests in isolated (forked) environment. You can override this behavior with following configuration: org.apache.maven.plugins
Denis Bazhenov
  • 9,680
  • 8
  • 43
  • 65
1
2 3
18 19