surefire

Surefire is not picking up Junit 4 tests

南笙酒味 提交于 2019-12-04 21:00:51
I cannot get Maven Surefire to execute my JUnit 4 tests even after I tried all the advices from another post. My POM: <project> <modelVersion>4.0.0</modelVersion> <groupId>maven-test</groupId> <artifactId>maven-test</artifactId> <version>0.0.1-SNAPSHOT</version> <dependencies> <dependency> <groupId>org.junit</groupId> <artifactId>com.springsource.org.junit</artifactId> <version>4.4.0</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source

What is a good way in maven/surefire to clean up after unit tests, whether they pass or not?

青春壹個敷衍的年華 提交于 2019-12-04 15:02:53
We have some unit tests that unfortunately create memory-mapped NIO files that cannot be deleted by the process that created them (some windows issue). Regardless, I would like to run some sort of clean up after these tests, whether they passed or not. I was going to run a small ant script at the prepare-package phase, but if any test fails, surefire exits immediately. Apart from going to the failsafe plugin which has a post-test phase, is there any clever way I can run my cleanup regardless of pass or fail? I suspect not - I've gone through all the surefire config options... edit: memory

Excluding TestNG Groups From Maven

微笑、不失礼 提交于 2019-12-04 12:09:09
I have some slow tests that rely on the database that I don't want run every time I build my project with Maven. I've added the excludedGroups element to my pom file as explained http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#excludedGroups but I can't seem to get it working. I've created a minimal project. Here is the pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId

How to tell Sonar to use my surefire reports for unit test results

吃可爱长大的小学妹 提交于 2019-12-04 11:22:34
We have a Jenkins job that contains a bunch of javascript files. We build our project via grunt, and at the end of the build we run JSCover to run our unit tests and collect code coverage. It all works. We get a nice LCOV file, and we get a bunch of TEST-*.xml in the target/surefire-reports/ directory. Sonar displays the code coverage results, but it doesn't show the number of tests that passed/failed or even executed. How do I tell sonar to use the surefire reports? I thought by setting this property, it would consume it, but no love: sonar.surefire.reportsPath=target/surefire-reports Here is

Maven + Surefire return code is 0 on failed tests

百般思念 提交于 2019-12-04 09:44:17
I have a project with tests split in unit and integration phases. I have it running buildbot and the problem is that even in tests are failing maven return code is 0 so buildbot build is succesful. This is the result of mvn integration-test: Results : Tests in error: Info about failed tests Tests run: 5, Failures: 0, Errors: 5, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1 minute 19 seconds [INFO] Finished at: Tue Feb 12 09:43

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

感情迁移 提交于 2019-12-04 02:54:55
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. Now, I move the suspect test into src/test/java and try again: 146 tests run, 0 skipped! The output of Maven gives no clue that other tests aren't being run, even with the -X flag. That brings me to my question: the reason I call the test 'suspect' is that the whole class is decorated with @Ignore, so I would imagine that including it in my test

Running single test class or group with Surefire and TestNG

邮差的信 提交于 2019-12-03 12:52:58
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 -Dgroups=skipped-group test mvn -Dsurefire.groups=skipped-group test when config is <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.7.1</version> <configuration> <groups>functest</groups> </configuration> </plugin> Parameters work fine in there are no groups defined in pom.xml. Similarly,

Intermittent NoClassDefFoundError when running a maven/surefire build in jenkins

限于喜欢 提交于 2019-12-03 08:58:24
问题 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 log below - JUnit is included in the classpath. The error seems to appear completely at random. Log Waiting for Jenkins to finish collecting data [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test)

Using custom reporters with the maven surefire plugin

懵懂的女人 提交于 2019-12-01 12:34:44
I'm trying to use a custom reporter for TestNG with the maven surefire plugin. I already have a custom listener and that seems to get picked up. However, it doesn't look like the custom reporter is being used at all: <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <testFailureIgnore>false</testFailureIgnore> <properties> <property> <name>listener</name> <value>com.mystuff.test.TestNGListener</value> </property> <property> <name>reporter</name> <value>com.mystuff.test.MyEmailableReporter</value> </property> </properties> </configuration> </plugin> Any idea why this is

Does Maven surefire plugin run tests using multiple threads?

梦想的初衷 提交于 2019-11-30 17:22:25
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 dictated by some means. I haven't verified this yet (I'll do so tomorrow just looking for some heads up guidance and verification at this point), but it looks as if my various JUnit Test classes are getting the tests run in some intermixed order. Which makes it a real pain to orchestrate the creating of the test resources (which are quite hefty in my case