surefire

Can I make Surefire perform expensive setup/teardown only once?

时间秒杀一切 提交于 2019-12-11 10:45:48
问题 I have a series of unit tests that all need to talk to an Apache Zookeeper server. Obviously, if I had a library for mocking server connections (or an easy way to roll my own) that would be optimal, but as far as I can tell none exists at this point, and there's enough moving parts under the hood that I hesitate to try it by hand. So, our solution so far has been to stand up a dummy server locally, perform the tests, then tear it down at the end. This kind of works, though as far as I can

Maven + Surefire/Failsafe - forkMode=“perthread” is not working … a workaround?

你。 提交于 2019-12-11 01:55:29
问题 We are developing an application based in an Embedded Infinispan Data-grid cluster. In the targeted environment of our application, each member of the data-grid will run in a independent JVM and using jgroup the cluster will be formed (this is done by Infinispan actually). For do some automated testing over this data-grid we were working with maven-surefire-plugin (or maven-failsafe-plugin ) with this configuration: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven

“Skipping execution of surefire because it has already been run for this configuration”?

≯℡__Kan透↙ 提交于 2019-12-11 00:57:09
问题 Please excuse the newb question - my conceptual models are still quite incomplete... I'm trying to re-execute TestNG tests from a command line using maven and surefire. My command line looks like: D:\workspaces\workspace01\aptest>mvn clean install surefire:test -Dtests=myTestNGSuite test Clearly I'm not getting it because the output I end up with includes: [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ aptest --- [INFO] Skipping execution of surefire because it has already been

Maven 2 plugin, build + surefire

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 19:37:19
问题 If i define a plugin in the <build> tag and want to use this in my site command how do i do that? Do i have to define the plugin within <reporting> tag again? And how about the configuration which i probably have done within the build tag and want to take place at the reporting tag as well? (i dont want to specifie for example a location of a configuration file twice just to use a plugin in 2 lifecycles) As example: I define my checkstyle plugin in the build tag and configrue a custom

Debugging maven junit tests with filtered resources?

折月煮酒 提交于 2019-12-10 17:04:01
问题 We are using filtered testResources in JUnit-tests that are usually executed by the maven surefire plugin. That is, the pom contains a section <build> <testResources> <testResource> <directory>src/test/resources</directory> <filtering>true</filtering> </testResource> </testResources> ... How can I run such JUnit-tests in the debugger? If I execute the tests in eclipse the tests fail since the test resources are not filtered. If the filtered test resources would be written somewhere into the

Unbelievable: Cannot cast from class X to its super class

给你一囗甜甜゛ 提交于 2019-12-10 09:32:04
问题 I'm encountering a very weird problem with Spring (3.0.1.RELEASE), TestNG (5.11) and Maven Surefire (2.5). I have a test class that extends a Spring helper class for testNG so that test context can be loaded from an xml file (that contains some bean definitions). My project was imported into eclipse using m2eclipse (using Import Maven Project) The class run fine in Eclipse TestNG runner. However, it throws this exception with Maven Surefire Caused by: java.lang.ClassCastException: com.sun.org

How do I make the manifest available during a Maven/Surefire unittest run “mvn test”?

故事扮演 提交于 2019-12-08 16:03:26
问题 How do I make the manifest available during a Maven/Surefire unittest run "mvn test" ? I have an open-source project that I am converting from Ant to Maven, including its unit tests. Here's the project source repository with the Maven project: http://github.com/znerd/logdoc My question pertains to the primary module, called "base". This module has a unit test that tests the behaviour of the static method getVersion() in the class org.znerd.logdoc.Library . This method returns: Library.class

Stop Tests on first Failure with Maven/JUnit/Spring

那年仲夏 提交于 2019-12-08 02:49:49
问题 I'd like Maven to stop trying to run my JUnit Spring tests when it encounters the first error. Is this possible? My test classes look like the following, and I run them just as a standard Maven target. @ContextConfiguration(locations = {"classpath:/spring-config/store-persistence.xml","classpath:/spring-config/store-security.xml","classpath:/spring-config/store-service.xml", "classpath:/spring-config/store-servlet.xml" }) @RunWith(SpringJUnit4ClassRunner.class) @Transactional public class

run maven tests from classpath

微笑、不失礼 提交于 2019-12-07 10:15:29
问题 In order to clean up something of a giant mess, I set out to put the code of my tests all in one ordinary java project (all in src/main/java), and then declare that as a <scope>test</scope> dependency in another project, and expect the tests to run. No such luck. surefire wants to just run the tests that it can see in the sources. I can see a sadly obvious solution here involving the build-helper-plugin and adding the tests into the test compilation environment as a source directory, but I

Maven Surefire: Unable to fork parallel test execution

怎甘沉沦 提交于 2019-12-07 01:05:58
问题 using Maven surefire, I'm unable to fork parallel test execution. That is, each of my test cases hs to run in a serapate JVM, hence the forking. In addition, I want my test cases to run in parallel. the first part is working without problem: I'm able to run each test case in its own JVM. the second part, however is still a challene for me. I haven't managed to get the paralle execution of test cases working. Here is how my plugin declaration look like: <plugin> <groupId>org.apache.maven