maven-surefire-plugin

Unit test failing due to surefire plugin's forkmode

萝らか妹 提交于 2020-01-15 03:53:12
问题 There is a test in my code which creates a directory and then creates a file inside it. However, this test fails as the portion of the test that writes the file is not able to find the directory that is created. The only thing that fixes it is to set the surefire plugin to never fork like so: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <forkMode>never</forkMode> </configuration> </plugin> I would interpret this fix to

Append the value of argLine param in maven-surefire-plugin

那年仲夏 提交于 2020-01-10 19:37:07
问题 I am using maven-surefire-plugin + Sonar together and I would like to add some extra value to argLine parameter of the maven-surefire-plugin. So I did it: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.20.1</version> <configuration> <argLine>-DCRR.Webservice.isSimulated=true -D...</argLine> </configuration> </plugin> ... </plugins> </build> But in this case I am overwriting the original value of the argLine

No test run when running maven test command

青春壹個敷衍的年華 提交于 2020-01-03 01:12:28
问题 There is a maven project hosted by someone else, which has src/main directory and src/test directory. The src/test dir contains a java file ending with Test , I'll just call it ATest.java , and the class ATest only contains a static void main function. It is like //omitted public class ATest { public static void main(String[] args) throws Exception { BTester.main(null); CTester.main(null); } } where BTester and CTester are both files under directory src/main/java/<package_path>/tester When I

Running Unit Tests using Maven in Spring LTW Environment

自作多情 提交于 2020-01-01 09:10:33
问题 I am developing an application in a ddd architecture using Spring LoadTimeWeaving feature. The problem is i can run my Junit tests using eclipse but not through Maven. I have tried all the options given on various sites but it simply isn't working. I get the following exception: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver': Initialization of bean failed; nested exception is java.lang.IllegalStateException: ClassLoader [sun

Maven surefire 2.12 does not run a specific test using -Dtest parameter

跟風遠走 提交于 2020-01-01 02:54:26
问题 After upgrading all my Maven plugins version for a project, I encountered the following problem: when I run the basic command mvn test -Dtest=SomeTest , the build finishes with no test executed at all. In fact, I am not able to run any test using -Dtest parameter (of course the test exist, and is run when I simply execute mvn test ). After some searches, it appears that the problem is due to the usage of surefire 2.12 plugin. I've tested several versions of Maven (2.2.1 / 3.0.2) and JUnit (4

How to run parallel suites in maven and Testng

大憨熊 提交于 2019-12-31 05:44:06
问题 I want to the Test Suites parallel from maven. my pom.xml looks like below: <profiles> <profile> <id>API_AUTOMATION</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> <parallel>suites</parallel> <threadCount>8</threadCount> <suiteXmlFiles> <!-- TestNG suite XML files --> <suiteXmlFile>./module1.xml</suiteXmlFile> <suiteXmlFile>./module2.xml</suiteXmlFile> </suiteXmlFiles>

Running test in parallel with surefire and displaying them properly with the TestNG Jenkins plugin

和自甴很熟 提交于 2019-12-31 04:58:05
问题 I'm running tests with parallel execution using surefire, and that all seems to work fine. However, there's only one testng-results.xml generated in the target/surefire-reports/ folder which ... only contains the results of the test that ran last. I found an issue exactly for that reported for an older version of surefire, and it says "won't fix" here: http://t161727.apache-maven-issues.apacheforum.info/surefire-1018-surefire-reports-overwrite-each-other-whenusing-forking-t161727.html However

How to run Maven surefire without printing out test results to the command line?

大兔子大兔子 提交于 2019-12-30 04:40:06
问题 I am running the Maven 3.1.0 Surefire plugin already with the --quiet option, however it still prints out the results of unit tests out to the command line, even if they all pass. Is there a way to only get it to print failures? The output I'd like to suppress if everything is fine looks like: ------------------------------------------------------- T E S T S ------------------------------------------------------- Running net.initech.project.dawgs.actionfactory.InterfaceActionFactoryTest Tests

What is the difference between the Maven Surefire and Maven Failsafe plugins?

南楼画角 提交于 2019-12-29 11:30:42
问题 What is the difference between Maven Surefire and Maven Failsafe plugins? I have searched all over web, but did not get the answer. 回答1: In simple words, the Failsafe plugin is designed to run integration tests while Surefire to run unit tests . This is further explained in Maven FAQ: maven-surefire-plugin is designed for running unit tests and if any of the tests fail then it will fail the build immediately. maven-failsafe-plugin is designed for running integration tests , and decouples

Can we execute exec-maven-plugin before maven-surefire-plugin?

喜你入骨 提交于 2019-12-25 09:26:59
问题 Is it possible to run exec-maven-plugin before maven-surefire-plugin, what I observe during my run is maven-surefire-plugin is executing first even though the sequence in tag is second. My scenario is to execute JAVA CLASS (using exec-maven-plugin ) which generates my testng.xml and can run that using (maven-surefire-plugin). 回答1: First of all, if you have an execution of the exec-maven-plugin bound to the test phase, it is normal that this execution is performed after the one of the maven