maven-surefire-plugin

Maven (Surefire): copy test resources from src/test/java

二次信任 提交于 2019-11-30 11:47:10
问题 Maven's Surefire (testing) plugin mvn test-compile copies files in src/test/resources to target/test-classes . It compiles .java in src/test/java , and copies the compiled .class files to target/test-classes . But it doesn't copy resources from src/test/java , and it's more convenient to be able to put test resources in the same directory as the .java classes they are resources for, than in a parallel hierarchy in src/test/resources . Is it possible to get Maven to copy resources from src

Maven separate Unit Test and Integration Tests

两盒软妹~` 提交于 2019-11-30 10:47:17
问题 UT = Unit Tests IT = Integration Tests. All my Integration test classes are annotated with @Category(IntegrationTest.class) My goal is: mvn clean install => runs UT and not IT mvn clean install -DskipTests=true => no tests are executed mvn clean deploy => runs UT and not IT mvn clean test => runs UT and not IT mvn clean verify => runs UT and IT mvn clean integration-test => runs IT and UT are not executed mvn clean install deploy => runs UT and not IT pom properties: <junit.version>4.12<

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

不羁岁月 提交于 2019-11-30 08:46:48
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) container it fails with error like below. The only circumstances when it runs is when I disable forking for Failsafe plugin but that is not an option going forward. I tried all sorts of Java/Maven/Failsafe/Surefire options I could have found using Google but no luck (like adding global Java -Xmx options and also per plugin in pom.xml). Has anyone ran it

NoSuchMethodError with Hamcrest 1.3 & JUnit 4.11

限于喜欢 提交于 2019-11-30 07:49:56
Another instance of the NoSuchMethodError for the JUnit & Hamcrest combination. Offending code: assertThat(dirReader.document(0).getFields(), hasItem( new FeatureMatcher<IndexableField, String>(equalTo("Patisnummer"), "Field key", "Field key") { @Override protected String featureValueOf(IndexableField actual) { return actual.name(); } } )); Commented lines 152–157 in IndexerTest.java (commit ac72ce ) Causes a NoSuchMethodError (see http://db.tt/qkkkTE78 for complete output): java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V at org

What does the “default-test” stand for in the maven-surefire plugin

谁说胖子不能爱 提交于 2019-11-30 07:30:43
问题 I have defined the following configuration in my pom for surefire with TestNg: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12</version> <configuration> <skipTests>${skip-all-tests}</skipTests> </configuration> <executions> <execution> <id>unit-tests</id> <phase>test</phase> <goals> <goal>test</goal> </goals> <configuration> <skip>${skip-unit-tests}</skip> <groups>unit</groups> <excludedGroups>integration</excludedGroups> <

Surefire doesn't launch test in src/main/java

非 Y 不嫁゛ 提交于 2019-11-30 06:56:57
问题 I needed to move some src/test/java to src/main/java according to this recommandation from maven-jar-plugin documentation => http://maven.apache.org/plugins/maven-jar-plugin/usage.html I did so because, i used tests (helper) classes in another projects in test scope. So i create my-project-test, moved in test classes, and configured surefire to specify test classes directory => <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId

maven-surefire-report-plugin not generating surefire-report.html

倖福魔咒の 提交于 2019-11-30 05:47:23
问题 I'm unable to get the maven-surefire-report-plugin to generate the surefire-report.html when I run: mvn clean deploy site mvn clean site mvn site mvn clean install site The only time I've been able to get the report generated is when I run: mvn surefire-report:report Here is a look at my 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

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

自作多情 提交于 2019-11-30 05:07:03
问题 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 dependency on Junit 4.12 , it is stated in Junit documentation that this feature is supported only for Junit 4.x , basically Spock should propose something similar. 回答1: After a further investigation, the answer is most probably: No, you can't invoke

How to run a maven goal when there is tests failures?

本秂侑毒 提交于 2019-11-30 04:41:38
问题 I would like to know if there is a way to execute a goal when there is test failures? Since maven stops its execution (fail fast mode) after encountering a test failure, is there any options to launch a goal when there is test failures? Regards. 回答1: I've been searching for a way to do this as well, with not much success. However, there is the following question which might provide some general hints: Maven reporting plugins do not execute if a unit test failure occurs The idea is that you

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

自作多情 提交于 2019-11-30 02:37:35
问题 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 plugins we use don't yet support maven 3) as our primary build tool, and the maven-surefire-plugin (2.19) to run unit tests. We are using the maven-surefire-plugin in parallel mode, where both the individual methods are run in parallel and the unit