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
27
votes
4 answers

how to debug maven surefire test more easily (using eclipse as debug server)

I'm using maven / surefire / eclipse to write some code and later test / debug it. Standard way to do it is by using maven.surefire.debug maven property. By default, when this property is enabled, maven starts listening on port 5005 and I can attach…
mateusz.fiolka
  • 3,032
  • 2
  • 23
  • 24
22
votes
1 answer

Generating html surefire test html output during test phase

I'm not sure if this is a simple question or not, but I'd like surefire to generate html formatted output files(in addition to the xml and txt formatted output files) during the test phase. I've tried to make this happen by adding an 'executions'…
Michael Kohout
  • 1,073
  • 1
  • 14
  • 26
19
votes
5 answers

Intermittent NoClassDefFoundError when running a maven/surefire build in jenkins

We are building a large multi module Maven project on Jenkins, including running a large number of unit test. Once every few builds the build fails on NoClassDefFoundError on RunListener - which is located in the unit jar. As you can see from the…
Nitzan Volman
  • 1,809
  • 3
  • 17
  • 31
19
votes
5 answers

Why isn't Drools working with Java 8?

I just installed the final version of Java 8. When I try to build my project with Maven, many tests fail if I use Java 8, but pass fine with Java 7. I've tried running it via the command line with JAVA_HOME set to C:\Program Files\Java\jdk1.8.0…
dhalsim2
  • 936
  • 2
  • 12
  • 35
18
votes
2 answers

How to show log4j output in surefire test resports

When a test fails in maven the surefire test report xml files in target/surefire-reports/TEST-.xml only shows the Standard Output System.output or Standard Error System.err When I use the jdk java.util.logging.Logger all the logging shows…
Serxipc
  • 6,639
  • 9
  • 40
  • 51
18
votes
3 answers

Maven/Surefire finds no tests to run

As far as I can tell, the test files location is correct. When I run "mvn test", it finds four classes named SomethingTest (they are located in the 'test' folder). However, it ignores any of the jUnit tests (jUnit 4, annotated with @Test). How do I…
ripper234
  • 222,824
  • 274
  • 634
  • 905
17
votes
2 answers

How to use Maven Surefire plug-in with different groups for test and integration-test?

I want to use testng with the Surefire plug-in of Maven. The idea is to tag some tests with a group integrationTest and run the plug-in twice: for goal test excluding the group integrationTest and for goal integration-test including the group…
Arne Burmeister
  • 20,046
  • 8
  • 53
  • 94
17
votes
4 answers

Does Maven surefire plugin run tests using multiple threads?

I'm wondering if the Maven surefire plugin either runs tests multi-threaded by default (and if so can the number of threads be controlled? ) or if it runs tests from the Test classes in a random order or predictable order, or if the order can…
harschware
  • 13,006
  • 17
  • 55
  • 87
14
votes
2 answers

JUnit and Surefire Parallel Tests - ForkCount & ThreadCount

I'm running Selenium tests on the Selenium Grid using the Surefire Plugin to execute tests. In terms of my test breakdown I have several classes, some of which have 1 test in there and some more than one test. So on my Grid i have 30 chrome web…
userMod2
  • 8,312
  • 13
  • 63
  • 115
13
votes
4 answers

How to: Run maven integration tests against a test environment (database)

I'm using maven and the maven-failsafe-plugin to start up jetty during the integration-test lifecycle phase. I then execute a number of (*IT.java) junit tests against my running webapp. This is working as expected. However, I would like to…
12
votes
2 answers

If I @Ignore a test class in JUnit4, does @BeforeClass still run?

Quick background: I've been hunting down a Maven / Surefire test-running problem for days now, and I've narrowed it down to a small number suspect of tests. The behavior I'm seeing is insane. I start with mvn clean test: 250 tests run, 0 skipped. …
Coderer
  • 25,844
  • 28
  • 99
  • 154
11
votes
2 answers

JUnit test inheritance doesn't work

public abstract class GenericTests { protected abstract T getT(); @Test public void test1() { getT(); } } public class ConcreteTests1 extends GenericTests { ... } public class ConcreteTests2 extends…
Andrey Agibalov
  • 7,624
  • 8
  • 66
  • 111
11
votes
4 answers

Running single test class or group with Surefire and TestNG

I want to run single test class from command line using Maven and TestNG Things that doesn't work: mvn -Dtest=ClassName test I have defined groups in pom.xml, and this class isn't in one of those groups. So it got excluded on those grounds. mvn…
Slartibartfast
  • 8,735
  • 6
  • 41
  • 45
11
votes
1 answer

Maven reporting and site generation for multiple module project

I am trying to get project with submodules to test and generate reports correctly, but have got some problems. I have the following project structure: parent |-test1 |-test2 and the pom.xml for parent looks like this:
stackoverflower
  • 3,885
  • 10
  • 47
  • 71
11
votes
5 answers

dummy:dummy:jar:1.0, surefire-junit4, maven and Nexus

So we recently implemented a Nexus server for our maven repository manager. We proxy about 30 outside repositories and funnel them all into a single group, which we point to in the settings.xml in mirrors with a *. Before that, we didn't have this…
Roy Lyons
  • 131
  • 1
  • 1
  • 6
1
2
3
18 19