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
Filter by
Sorted by
Tagged with
0 votes
0 answers
338 views

Including dependency containing cucumber(jUnit4) brakes maven-surefire-plugin test detection in jUnit5 project

I have specific dependency in my project which uses cucumber 6.2.0 and runes on jUnit4 with vintage engine. The dependency changes maven-surefire-plugin behavior when added to project. If I exclude ...
Dusko.B's user avatar
  • 41
0 votes
0 answers
257 views

How to mark the maven build status as Fail if there are skipped test in build result summary?

When I am running my TestNG test cases with the help of the maven surefire plugin, it skips a few test cases. And at the end my result summary comes like this: Tests run: 26, Failures: 0, Errors: 0, ...
QualityMatters's user avatar
2 votes
1 answer
3k views

Surefire is going to kill self fork JVM. The exit has elapsed 30 seconds after System.exit(0)

I'm using maven surefire plugin (LTS Version) to execute tests on two testing frameworks (e.g, jUnit, jBehave). Have tried to implement parallelisation by spawning couple of Threads which in turn ...
avocado's user avatar
  • 21
4 votes
1 answer
531 views

how to get maven to run all tests but still fail build on compile error

Suppose I have a multi-module maven project. I want to run it in such a way that: If a test fails, I still want to compile and test the next module. This sounds like a job for --fail-never, but see ...
Mark VY's user avatar
  • 1,587
2 votes
1 answer
306 views

Build Failure: Integration test fails on Jhipster generated project

I am running the following docker command on a gateway generated by jhipster project .\mvnw -ntp -Pprod verify jib:dockerBuild However, an error related to a failed integration test, here is the full ...
Khadija's user avatar
  • 65
0 votes
0 answers
75 views

Debugging Maven build in Eclipse 2022

Aim: I have a Maven application that does not have any JUnit testcases. I want to debug the app. Setup: I choose the Maven plugin maven.surefire.debug. I have specified the plugin details in the Run--&...
Mohan's user avatar
  • 139
0 votes
0 answers
590 views

I am getting error while building the project. Plugin 'org.codehaus.mojo:exec-maven-plugin:3.3.0' not found

The pom.xml is as shown below Here the codehaus.mojo is not proper and is highlighted as red and mouse hover says Plugin 'org.codehaus.mojo:exec-maven-plugin:3.3.0' not found. Post building the ...
Harshada khandekar's user avatar
0 votes
0 answers
108 views

ScenarioScoped mixes up token with SureFire parallel execution (Java + Maven)

I'm using Cucumber for my API tests and save the shared context in ScenarioContext class which is marked with @ScenarioScoped and @Injected per Steps class. Of course some features use steps from ...
ICT's user avatar
  • 25
0 votes
1 answer
282 views

Surefire not running all tests

I am trying to use a combination of Surefire (or even Failsafe if I can configure it to work properly), to run my integration tests for a personal project. At present it will run 2/3 of my integration ...
StruckCroissant's user avatar
0 votes
1 answer
73 views

Is there any workaround using which we can install multiple versions of same artifact in maven

I need to install multiple versions of same artifact in maven and use both of them in the same module, but since maven allows only one version due to it the import statements are breaking for either ...
sacp's user avatar
  • 1
0 votes
1 answer
173 views

Surefire marks tests as failed when they set SecurityManager

I have some tests that need to check if the main code did a System.exit(...). This works very nicely with suggestions from https://stackoverflow.com/a/309427/1023341. But when running these tests in ...
gkephorus's user avatar
  • 1,304
0 votes
0 answers
971 views

Getting testSuiteXmlFiles0 has null value while running maven command

i want to run the mvn command from the command line by providing the testng.xml as parameterizing ( in future integrate with jenkins with paramaterization of xml files) Running the command like this C:...
Learner's user avatar
  • 947
2 votes
0 answers
5k views

InaccessibleObjectException: module java.base does not "opens java.util" to unnamed module @61443d8f

I am new to java and maven so bare with me :) Using jdk 1.8 along with maven 3.8.5 on intellij IDE. Trying to run a test method where I set my unit test environment variables using Systemstubs like ...
DieDen's user avatar
  • 167
0 votes
1 answer
186 views

Why does Surefire fail to pick up my JUnit 5 tests in Quarkus and starting from version 3.0.0-M5

In my Quarkus project I work with a stock standard Quarkus setup of a project (https://code.quarkus.io/) and some internal libraries that rule JUnit 5 dependencies we use in all out projects. When I ...
gkephorus's user avatar
  • 1,304
0 votes
1 answer
363 views

Maven execute given integration test in certain module of a multi-module project

I have a multi-module project, with a structure like this: Then, I try to execute single integration test that is located in the pollen-reports-framework module, as below: mvn test -Dtest="com....
Nestor Milyaev's user avatar
1 vote
1 answer
630 views

why mvn clean verify is running surefire plugin only

My project structure is: Project_Name |-src/main/java |-src/test/java |-default package |-MyIT.java |-steps |-MySteps.java |-pom.xml MyIT.java: @RunWith(SerenityRunner....
a Learner's user avatar
  • 4,982
0 votes
1 answer
985 views

Maven Surefire plugin executes JUnit 4 tests, even though the JUnit Vintage Engine is not in Maven the project

I have a Maven project that contains both JUnit 4 and JUnit 5 tests. I am using the Maven Surefire plugin in version 3.0.0-M07. The following relevant dependencies are available in the Maven ...
Harold L. Brown's user avatar
0 votes
0 answers
103 views

Can maven run test when java directory is not directly under test directory?

Under the default maven folder structure, my maven test runs perfectly. I tried something slightly different by including a directory between the test directory and the java directly. This way, maven ...
matt's user avatar
  • 25
0 votes
0 answers
608 views

Configure maven-surefire-report-plugin to read from multiple source directories

I have configured surefire to use different output directories based on CPU count: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin&...
stwissel's user avatar
  • 20.2k
2 votes
1 answer
575 views

How to Mockito.spy on Graphics2D in Java 17

I have a maven project that should run on java-8, java-11. I want to add support for java-17 and I have some issues with testing. Simplified version of the test looks like: @Test public void ...
gawi's user avatar
  • 2,903
0 votes
0 answers
504 views

Maven 3.8 Difference between thread count and forkcount for suitsAndClasses parallelism?

I am having a surefire configuration like below <configuration> <forkCount>2</forkCount> <reuseForks>true</reuseForks> <perCoreThreadCount>false</...
tuk's user avatar
  • 6,303
1 vote
0 answers
191 views

Run Surefire tests in Maven with HTML output & a nonzero exit code on failure

I'm working on a Gitlab CI/CD pipeline for various Dockerized Java apps, using Maven to build them. The first step of the pipeline builds the app and pushes it to our registry. The second step is ...
macdjord's user avatar
  • 517
0 votes
0 answers
107 views

Change the order of test method execution in Maven (Junit) dynamically

I am looking for a way to change the order in which the test methods are executed inside of a test class using commandline. Three important remarks: Yes, I am fully aware of issues about test order ...
Alp Yilmaz's user avatar
3 votes
1 answer
1k views

Why does Surefire not find any tests when upgrading to JUnit 5?

There are common reasons why the subject question might be happening, but this is not a typical situation. We had many services with working JUnit4 tests. We are working on a process of upgrading ...
David M. Karr's user avatar
0 votes
2 answers
724 views

What is the difference between maven surefire plugin and maven surefire dependency

Maven Surefire Plugin [...] org.apache.maven.plugins maven-surefire-plugin 3.0.0-M6 [...] Maven Surefire dependency <groupId>org.apache.maven.plugins</groupId> <...
D. Sudhindra's user avatar
0 votes
0 answers
147 views

AWS CodeBuild - How to show Error test classes in case of unhandled exception from JUnit5 BeforeAll?

If there is an unhandled exception from JUnit5 BeforeAll like below then AWS Code Build is not able to show the failure test classes. class ApiImplTest { @BeforeAll public static void beforeClass()...
tuk's user avatar
  • 6,303
-1 votes
1 answer
239 views

Maven Tests not Running in sequential Order

I'm using a TestNG framework for my automation project. While running from command line i'm giving the following command. mvn clean test -Dtest=Login,OpenImage,Logout By running the above command it ...
AP01_250198's user avatar
3 votes
1 answer
495 views

What is the purpose of a JAR file without dependencies?

I have always used an uber-jar, created using Maven, but I am starting to wonder why or how do you use JAR files without the dependencies? What can you do with the jar file that doesn’t have ...
mastercooler6's user avatar
4 votes
1 answer
2k views

Maven Surefire Plugin not logging from org.junit.jupiter.api package

I'm getting some inconsistent behaviour in my unit test logging when either: Running tests via IntelliJ's Run interface Running tests via mvn test I really want to see the following log statements ...
Ian250221's user avatar
1 vote
1 answer
3k views

How to fix not finding a plugin artifact?

I am getting this error: [ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-...
ethicalhacker's user avatar
0 votes
0 answers
354 views

Issue with Maven Build command with openjdk@8

I am following along a course and have hit a roadblock and requesting some assistance. The original POM file given by the tutor is as follows:- <project xmlns:xsi="http://www.w3.org/2001/...
Sandeep Nair's user avatar
0 votes
1 answer
360 views

All maven surefire reports are zero! How could this happen?

I have a scala project configured with maven surefire plugin: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</...
tribbloid's user avatar
  • 3,926
1 vote
1 answer
4k views

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test

Apache Maven: 3.8.1 Java version: 1.8.0_311 Getting the below error while running the maven command in Jenkins pipeline. Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:...
Learner's user avatar
  • 481
0 votes
1 answer
474 views

Maven Surefire Test Rerun Parameter Does Not Re-Run Failing Tests

Maven surefire does not rerun failing tests. I tried to change the surefire version to 3.0.0-M4, 3.0.0-M5. Use commandline option -Dsurefire.rerunFailingTestsCount=3, added <surefire....
alperenn's user avatar
2 votes
0 answers
750 views

Surefire XML test reports for JUnit 5 test suites

I've just migrated to JUnit 5 and I can't see any test cases in the XML test reports for my test suites. I've written my test suites in the new JUnit 5 syntax for junit-platform-suite and the tests in ...
aa64's user avatar
  • 33
0 votes
1 answer
2k views

Maven Surefire not detecting Junit5

I have a very simple Maven project that I updated here, I obtained it simplifying my real project: GitHub repository I need to run Surefire plugin to compile tests, so they can be used by Jacoco. I ...
Pipkin's user avatar
  • 99
3 votes
0 answers
599 views

maven-surefire-plugin consoleOutputReporter parameter doesn't work

I'm looking for solution to customize console test results output and found out that it is possible with implementation of org.apache.maven.plugin.surefire.extensions.SurefireConsoleOutputReporter ...
Serhii Kachan's user avatar
0 votes
2 answers
2k views

Maven surefire plugin doesn't find unit tests

Yes, the Java classes which are containing the tests are named correctly. (they are ending with Tests) Tried to add the following configuration in pom.xml: <configuration> <...
Dava Loper's user avatar
2 votes
1 answer
2k views

How to run JUnit5 suite using the @Suite annotation

I'm trying to figure this out for over a year now but I can't run JUnit5 suites unless I use the JUnit4 @RunWith annotation, which brings me some other issues. I'm trying to use the newer @Suite ...
Francislainy Campos's user avatar
0 votes
1 answer
341 views

How to save Maven Surefire reports through Google Cloud Build

We have a Java project that we build using Maven. We use the Surefire plugin to generate a report on test results. If I build the project locally, I can find the report files under the project's &...
Glenn's user avatar
  • 53
0 votes
1 answer
279 views

java Junit4 and JUnit5 not picking JUnit5 tests

I have a work environment including bom I dont manage and JUnit5 tests are not picked up unless I import my @Test annotation for test methods from import org.junit.Test; if I import them from import ...
Pipo's user avatar
  • 4,851
1 vote
1 answer
3k views

Maven: no marketplace entries found to handle maven-compiler-plugin:3.8.5

Noob here. Downloaded a repo from a past and forgotten project to try to relearn automation but I'm stuck with this error. I tried updating maven project but still can't come up with a solution. Hope ...
Christian Francis Dayao's user avatar
1 vote
1 answer
1k views

Quarkus log output when running tests in Maven

If I run unit tests for Quarkus from inside Eclipse, the Eclipse console view shows Quarkurs' log output. However, when I run the same tests in Maven, the Quarkus output is completely swallowed and ...
sithmein's user avatar
  • 447
1 vote
1 answer
321 views

How to profile tests running on remote machine using JProfiler

I have a java project that runs thousands of test cases. I am using maven-surefire-plugin with testng. I want to profile these tests while they are running on the remote machine. It's basically a ...
ravinder kaushal's user avatar
1 vote
1 answer
393 views

'ClassCastException class [B cannot be cast to class [C' when attempting to generate spock reports

When generating unit test reports using spock-reports, I'm getting a ClassCastException: class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap') I'm using Java ...
roj's user avatar
  • 1,311
0 votes
1 answer
727 views

Why is Surefire not executing my JUnit5 tests?

I'm trying to convert one Maven SpringBoot (2.3.12) app from JUnit4 to JUnit5. I've read many different posts on how to do this. I'm able to execute my JUnit5 tests in Eclipse. My problem is that I ...
David M. Karr's user avatar
0 votes
1 answer
638 views

Maven sure-fire-report name change not working

I am using Maven Sure fire plugin to generate report for my selenium TESTNG test suites. After the test, it generates the output in the location ..\target\local\surefire-reports. The name of the ...
user1015388's user avatar
  • 1,385
15 votes
1 answer
12k views

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 ...
Maurycyt's user avatar
  • 706
2 votes
1 answer
331 views

Surefire 3.0.0-M5 suiteXmlFile not recognized

I try to run a testng suite via maven. This is the plugin within my build dependencies of the pom: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-...
nano_nano's user avatar
  • 12.5k
1 vote
1 answer
873 views

maven surfire testng execution not working

I have problems setting up my project for testng usage. Background is that I want to execute my test.xml with maven command line. I use this plugin within the build section of my pom.xml: <plugin&...
nano_nano's user avatar
  • 12.5k

1 2 3
4
5
33