maven-surefire-plugin

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

左心房为你撑大大i 提交于 2019-11-30 01:23:06
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/test/java ? The resource copying is all done by the maven-resource-plugin, and if you read the doc thereof

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

左心房为你撑大大i 提交于 2019-11-29 23:19:42
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: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <suiteXmlFiles> <suiteXmlFile>${pathToMySuiteFile_1}</suiteXmlFile> <suiteXmlFile>${pathToMySuiteFile_1}</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin> This solution has some limitations. I can only change a path to the test suite I've got defined in pom.xml. So in

How to execute JUnit and TestNG tests in same project using maven-surefire-plugin?

浪尽此生 提交于 2019-11-29 21:18:50
Right now I have both type of tests but when I say "mvn test" it only executes TestNG tests and not Junit. I want to execute both one after another. Any Idea ? There is an open issue for thi s, so there's no elegant way to do this. It would be far simpler for you to pick a framework and stick with it. Edit: My previous answer doesn't work because you can't specify dependencies in the execution. I've tried a few approaches, but the best I can manage is to create a profile for the TestNG dependency so you can toggle between TestNG and JUnit testing, there doesn't seem to be a means to run both

How to run individual test in the integration-test target in maven

冷暖自知 提交于 2019-11-29 20:53:22
We have a hundreds of tests defined for our integration-test phase lifecycle in maven, and they take a long time to finish. What I want to do is run just one test in the integration-test . I tried doing : mvn -Dtest=<my-test> integration-test but that does not work. The -Dtest runs only the tests in the unit test goal, not the integration-test phase. I tried the -Dintegration-test=<my-test> instead, and that was ignored. Is there a way to do that ? My configuration is: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <executions> <execution>

Execution time of tests in unit test class via maven surefire-report in a single file in summarized format

梦想与她 提交于 2019-11-29 20:04:10
问题 Can anyone let me know how can I get the time taken by each of the unit tests in a unit test class in a single file via maven-surefire ? I have seen my target/surefire-report it has files for each test. Basically I am looking for a single file with all the execution times summarized. If possible also sort the result by execution time of each test. I am using maven 3.5 & surefire-plugin 2.4.2 on MacOSX 10.12.6. 回答1: The maven-surefire-plugin currently doesn't let you do this. It writes all the

Maven surefire: append to argLine

守給你的承諾、 提交于 2019-11-29 17:17:40
问题 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 the concatenation of its current value plus what I set. I was hoping it would as simple as <argLine>${argLine} -DnewVMArg</argLine> Is there something similar I can do to make this happen? I made an attempt at fixing it which results in maven

maven-surefire-plugin include/exclude precedence

不羁岁月 提交于 2019-11-29 16:33:49
问题 When using the maven-surefire-plugin and both includes and excludes, which order are they processed in? Furthermore, if you have 3 sets of tests, the first being the base set, the second and third being special cases, can you use profiles to further include/exclude? How will the profile include/exclude settings be merged? For example, I would like to do something like this: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId>

Maven build and maven-failsafe-plugin - The forked VM terminated without properly saying goodbye

大兔子大兔子 提交于 2019-11-29 13:31:46
I use Docker and https://github.com/fabric8io/docker-maven-plugin for my integration tests. On my Windows 10 ( after updating to Windows 10 1709 ) machine I faced the following error with my Maven 3.5.0 build: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.20.1:verify (default) on project api: There are test failures. [ERROR] [ERROR] Please refer to D:\Projects\example\api\target\failsafe-reports for the individual test results. [ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream. [ERROR]

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

我是研究僧i 提交于 2019-11-29 12:26:54
问题 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

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

左心房为你撑大大i 提交于 2019-11-29 04:14:39
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> </configuration> </execution> <execution> <id>integration-tests</id> <phase>integration-test</phase> <goals>