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

Perform checks against XML files, such as Oracle OSB files and Soap-UI test files

Looking for a way we can do checks on XML files, beyond just schema validation. Have found a few references to Schematron which looks interesting, but struggling to see how we can piece this all toegether: Problem Background We're dealing with…
Nathan
  • 51
  • 5
4
votes
3 answers

How to specify JUnit custom runner for Surefire Maven plugin?

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…
Michael
  • 10,185
  • 12
  • 59
  • 110
4
votes
3 answers

Using JUnit RunListener with Maven

I want to use my own RunListener on my unit tests. So I've created the following class: public class MyRunListener extends RunListener { public MyRunListener() { System.out.println("Creation of Run Listener..."); } @Override …
Romain Linsolas
  • 79,475
  • 49
  • 202
  • 273
4
votes
2 answers

Order of Maven+Surefire+Testng - BeforeClass, BeforeTest, Test, Test, AfterTest, AfterClass

I expected the following output: Running TestSuite [DEBUG] beforeClass [DEBUG] beforeTest [DEBUG] test [DEBUG] afterTest [DEBUG] beforeTest [DEBUG] test [DEBUG] afterTest [DEBUG] afterClass But instead, this actually happens. Notice 2 problems:…
campbell
  • 91
  • 1
  • 4
4
votes
3 answers

run maven tests from classpath

In order to clean up something of a giant mess, I set out to put the code of my tests all in one ordinary java project (all in src/main/java), and then declare that as a test dependency in another project, and expect the tests to…
bmargulies
  • 97,814
  • 39
  • 186
  • 310
4
votes
3 answers

Is possible to run same test multiple times with Maven Surefire Plugin?

There is a config value rerunFailingTestsCount but I want to run a test method a configurable number of times even it is successful. Are there any options?
nayakam
  • 4,149
  • 7
  • 42
  • 62
4
votes
1 answer

Build fails because of Maven Surefire

Has anybody an idea why I get this erromessage after running the tests of this package? I have already tried to give more memory but it did not suceed. Now I am really desperate to solve this problem. This project contains the client of the…
MJCM
  • 41
  • 1
  • 2
4
votes
3 answers

Surefire run certain tests in sequence, others in parallel

Is there a way to make certain tests run in in sequence with the surefire plugin for JUnit? Currently it is running all tests in parallel, but some tests are very hard to convert and it would be sufficient if they didn't run in parallel. Here is a…
Mattias
  • 1,110
  • 1
  • 11
  • 26
4
votes
1 answer

How to write something to surefire log with JUnit 4

Is it possible to write something from inside the test to surefire-reports/MyClass.txt ? Any kind of logger etc ? There is a Reporter in TestNG: Reporter.log("Something here"); and the message appears under test method in report. Is there…
Piotr Gwiazda
  • 12,080
  • 13
  • 60
  • 91
4
votes
1 answer

How to run Maven surefire where each test class has its own parallel JVM?

No matter what settings I use for Maven + Surefire, I never see more than a single JVM spawned in my process manager. I have a Windows 7 PC with 8 physical cores. I am running the latest Maven / Surefire / JUnit and JDK8 (32-bit). I tried…
kevinarpe
  • 20,319
  • 26
  • 127
  • 154
4
votes
2 answers

Debugging maven junit tests with filtered resources?

We are using filtered testResources in JUnit-tests that are usually executed by the maven surefire plugin. That is, the pom contains a section src/test/resources
Dr. Hans-Peter Störr
  • 25,298
  • 30
  • 102
  • 139
4
votes
1 answer

disable junit execution in surefire with testng provider

We have a mixed testng/junit (3 and 4) project and have configured maven to have two surefire executions; one for junit and one for testng. I noticed that between surefire 2.15 and 2.16 (and 2.17), our testng provider started executing some of our…
Jilles van Gurp
  • 7,927
  • 4
  • 38
  • 46
4
votes
1 answer

Can I use groups and excludedGroups in maven-surefire-plugin?

Can I annotate a test class annotated with a Category for inclusion and then annotate certain test methods with another Category for exclusion? I tried the following but it just uses the groups to include the test classes. Then surefire does not…
4
votes
1 answer

Invoke a method after all tests run in JUnit

I want to create custom html report for test run in JUnit. Problem I have is releasing resources and closing tags after all tests are done. I keep one FileChannel opened for writing to report. Since it should be table with row for each test and…
Olek Olkuski
  • 93
  • 2
  • 8
4
votes
1 answer

Mockito fails in Maven but succeeds in Eclipse

We have a test wich fails when executed in Maven, but succeeds in Eclipse. Basically the problem is, that when executed with Maven Mockito fails to mock a method which comes from a superclass from another maven module with package private…
Jens Schauder
  • 77,657
  • 34
  • 181
  • 348