Questions tagged [maven-surefire-plugin]

The Surefire 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.

Maven Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application.

It runs unit tests of a maven project and produces reports in text, XML and HTML format. By default, it will fail the build if the unit tests fail. It supports multiple unit test frameworks, notably JUnit and TestNG.

Its only goal is the test goal. Check its official usage page for a first sample.

1351 questions
16
votes
1 answer

Running tests with maven packaging type "pom"

I'm having some issues running my unit tests when my pom is set to packaging type "pom". At first, it was saying no goals needed for this project, so I added the maven-surefire-plugin to my pom.xml to bind the test phase to the maven-surefire-plugin…
user977208
  • 603
  • 2
  • 5
  • 13
16
votes
1 answer

Kotlin - Maven not executing tests

I have a Kotlin application which I want to test. My tests (.kt) files execute with success in Eclipse. (The test itself is a h2 mock jdbc test). Now when running mvn test -X it says: releases: [enabled => true, update => never] ] [DEBUG] (s)…
Ivar Reukers
  • 7,560
  • 9
  • 56
  • 99
16
votes
4 answers

Maven surefire: append to argLine

I have 2 profiles that may or may not be used together to run a group of tests. They each require different vmargs to run, but if they are used together it's ok to have them appended to each other. What I'm looking for is a way to set argLine to be…
user321605
  • 846
  • 2
  • 7
  • 20
15
votes
1 answer

How do I configure maven to print JUnit assertion failure message to console

I'm using the surefire maven plugin to run unit tests. My test class looks like this: public class Test1 { @org.junit.Test public void testThatFails(){ Assert.assertTrue("false is never true", false); } } When a test fails I expect to see…
cyber-monk
  • 5,470
  • 6
  • 33
  • 42
15
votes
3 answers

what, besides Class objects, is stored in Perm Gen Space (sun 1.6 VM)?

I am seeing 'java.lang.OutOfMemoryError: PermGen space' while running ~300 JUnit tests and using Spring context. Having a tough time figuring out what's eating up PermGen since: in steady state the app consumes about 90m of permgen space I've tried…
Nikita
  • 6,019
  • 8
  • 45
  • 54
15
votes
2 answers

Jacoco - "Caused by: java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_6da5971.Offline"

Trying to get coverage via jacoco using offline instrumentation (can't use on-the-fly instrumentation: due to powermock testcases) for a maven project.Added the jacocoagent.jar to classpath in surefire plugin as shown below. Renamed the…
gthy
  • 301
  • 1
  • 3
  • 10
15
votes
1 answer

How to identify slow unit tests when using maven-surefire-plugin in parallel mode?

With a view to managing / reducing our build times, I want to identify which unit tests are taking the most time - in a parallel test environment using the maven-surefire-plugin. We are using JUnit (4.10) for unit tests. We use maven (2.2.1 - some…
amaidment
  • 6,942
  • 5
  • 52
  • 88
15
votes
5 answers

Troubles with SureFire plugin: -"The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? "

While running of unit tests following exception occurs: org.apache.maven.lifecycle.LifecycleExecutionException: ExecutionException; nested exception is java.util.concurrent.ExecutionException: java.lang.RuntimeException: The forked VM terminated…
johnny-b-goode
  • 3,792
  • 12
  • 45
  • 68
14
votes
1 answer

Maven Surefire test failed: Unsupported class file major version 61

I am trying to create a project in IntelliJ using Maven, but when running mvn install or mvn test in order to run the simple JUnit tests I wrote, it fails with the following error: Failed to execute goal…
Maurycyt
  • 676
  • 3
  • 19
14
votes
8 answers

Docker->Maven->Failsafe->Surefire starting fork fails with "The forked VM terminated without properly saying goodbye. VM crash or System.exit called?"

As per title: I'm trying to run Maven automated test from Jenkins slave that is containerized and after battling this for a week now I'm running out of ideas. It works as is on AWS instance with 4G of RAM but in unrestricted (on RAM and CPU)…
mironq
  • 346
  • 1
  • 3
  • 9
14
votes
3 answers

How to parametrize Maven surefire plugin so I can choose which TestNG suites to run

I've got many test suites in TestNG. These are XML files. I want to be able to choose multiple XML suites when running integration-test from maven. Currently I can add the suite files to pom.xml like this:
maestr0
  • 5,318
  • 3
  • 28
  • 27
13
votes
1 answer

Skip single test with maven with command line options

I would like to skip a single test (e.g. com.example.MyTest) when building a project with Maven from the command line. I'm aware of similar questions like this one, but they all require either modification of source code or pom.xml. I would like to…
Mifeet
  • 12,949
  • 5
  • 60
  • 108
13
votes
3 answers

Run a specific test in a single test class with Spock and Maven

I am using Spock framework for testing (1.0-groovy-2.4 release). Junit offers this option to run a specific test using the command line (with Maven): mvn -Dtest=TestCircle#mytest test Question: How can I do this with Spock? This version has a…
Rafik EL YAAGOUBI
  • 392
  • 1
  • 5
  • 20
13
votes
4 answers

JUnit Test "Times Out" Despite Executing Quickly?

I've got a couple of test cases that JUnit is telling me time out in 10000ms when the whole test run only lasts a couple of seconds. Here's the output: Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.528 sec <<<…
sigpwned
  • 6,957
  • 5
  • 28
  • 48
12
votes
4 answers

Report not being generated with Maven-Surefire-Report plugin

As the title suggests, I'm trying to generate an HTML report of the JUnit results when my maven project executes. I was told to check out maven-surefire-report plugin by another person and it looks like it has what I'm wanting but I just can't seem…
user1818298
  • 509
  • 2
  • 8
  • 23