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
0
votes
1 answer

How to separate surefire report into 2 or more categories?

I want to separate tests into 3 different categories: unit componnet system Then I want to run them separately on different phases and display results of execution these tests into 3 different surefire reports, or maybe one but with tests resultsd…
0
votes
1 answer

maven surefire plugin - specifying a single test - does NOT run

I have this maven profile setup. org.apache.maven.plugins maven-surefire-plugin 2.8
12rad
  • 829
  • 2
  • 13
  • 28
0
votes
1 answer

Issue with maven + surefire-plugin and Spring @Autowired

I have been breaking my head in getting Spring @Autowired to work inside maven tests. When I run the JUnit tests inside IntellJ (did not try Eclipse) it works. But when I run mvn clean install, the JUnit tests fail with the following…
-1
votes
0 answers

The main class is unable to initialize Caused by: java.lang.NoClassDefFoundError: org/apache/maven/shared/invoker/MavenInvocationException

I am getting an error when I run the executable jar file. I have a main class in which I have used the invoker and it works, But after creating jar of the same code and running the jar is not working here Getting Error. I have the required…
-1
votes
1 answer

How to run JUnit5 tests in sequential order?

Is there a way to make tests for specific classes run in sequential order [JUnit5]?. I am using the sure-fire plugin when building the project and my tests on some classes fail, while when I run them in IntelliJ class by class they all pass. I have…
user19128690
-1
votes
1 answer

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 the order of execution was…
-1
votes
1 answer

Maven downloading surefire plugin 3.0.0-M2 inspite of not been specified in pom

We were building one of the projects with surefire plugin version with Maven 3.0.4 and Java 1.7 . Recently we changed to build code with Maven 3.3.9 and Java 1.8 . But we cam across NestedException issue which we resolved by adding surefire plugin…
Alim Azad
  • 471
  • 2
  • 9
  • 23
-1
votes
1 answer

When i run "mvn -Dtest=Hello#test test" then " java.lang.VerifyError: Cannot inherit from final class" is coming

Actully when i run the mvn -Dtest=Hello#test test then below error is coming like cannot inherit from final class. but that class that i'm using has no final keyword used, but still i'm getting this error. i have tried almost all the solutions from…
-1
votes
2 answers

JMockit: IntelliJ vs mvn test command line with surefire - Different behaviors

While implementing a unit test using JMockit with a @Capturing annotation and a Verification block for the "captured" variable I have 2 outcomes: IntelliJ: I can run and debug successfully, validating that the verification behaves…
Beyonder
  • 21
  • 1
  • 5
-1
votes
2 answers

TestNG: How to set SoftAssert as not Failured

I'd like to use TestnNG's SoftAssert type of assertion for getting some warnings. After test, in results are values eg: Tests run: 2, Failures: 2, Errors: 0, Skipped: 0 Can I get the result for failed SoftAssert as Errors or Skipped tests? Of…
-1
votes
1 answer

Regression report in Maven surefire-report on local box?

We do have regression reports on Jenkins, where I can see the newly failing tests I have searched on the surefire-plugin page, but could not find anything that is similar to what i see on the jenkins test report, but on my local-box. I am looking…
Ajeet Ganga
  • 8,353
  • 10
  • 56
  • 79
-1
votes
3 answers

Why I can run Junit test successfully while fail to build project?

guys: I have a question about Junit test as a newbie: I tried to build a JAR project. it failed and reported that a function in Junit test failed, but when I run that Junit test, it was successful. my teammate suggested me to check surefire-reports,…
lxiscas
  • 141
  • 1
  • 2
  • 13
-1
votes
1 answer

Is there a way to specify in Maven which JUnit tests run by package

I'm wondering if there is a way to specify in Maven which collection of JUnit tests run based on package names. An 'exclude' would be ideal, since I have fewer that I need not run than I have those that need to run.
Gary Sharpe
  • 2,369
  • 8
  • 30
  • 51
-2
votes
1 answer

How to read console output in maven surefire unit test

I am trying to test a method which has to print a specific string to System.out. I have used this answer to get this working with JUnit. This works fine with JUnit, but the tests are then run in a CI environment, by Maven surefire. The test then…
Vincent
  • 185
  • 1
  • 11
-2
votes
1 answer

How to change the value of a key in a properties file loaded by the maven-surefire-plugin without having to manually edit the file?

I am using maven sure fire plugin to load the key-value pairs from a properties file (testdata.properties) so that i can use it in my TestNG test method like @Test public void testDBConnection() { String dbEnvUsed =…
Jeeka
  • 861
  • 2
  • 11
  • 21
1 2 3
90
91