maven-surefire-plugin

Implementing TestNg suite programmatically and executing it via maven surefire

倖福魔咒の 提交于 2019-12-07 13:38:10
问题 How to implement TestNG test suite using java instead of testng.xml. i follow following procedure but i cannot run it with the maven suefire plug in. Please help TestNG testNG = new TestNG(); List<XmlClass> classList =new ArrayList<XmlClass>(); List<XmlTest> testList = new ArrayList<XmlTest>(); List<XmlSuite> suiteList= new ArrayList<XmlSuite>(); List<String> suiteNameList = new ArrayList<String>(); XmlTest xmlTest= new XmlTest(); XmlSuite suite = new XmlSuite(); XmlClass xmlClass = new

Maven: Surefire --dry-run?

浪尽此生 提交于 2019-12-07 09:55:03
问题 Is there some way to dry-run surefire? Something which would list wich tests would run, without running them. The goal is, to know which tests (would) run in JBoss AS7 testsuite under certain config. 回答1: There's a change by Janinko at https://github.com/janinko/maven-surefire/tree/feature/dryrun Which adds this option: -Dtest.dryrun=true Hopefully it will get to upstream. 回答2: No. If you want to verify you are running a subset of your tests under a particular configuration, you will have to

Running code before and after all tests in a surefire execution

℡╲_俬逩灬. 提交于 2019-12-07 04:12:35
问题 I have a Grizzly HttpServer that I want to run for the entire duration of a test group execution. Additionally, I want to interact with the global HttpServer instance from a @Rule inside the tests themselves. Since I'm using Maven Surefire rather than using JUnit test suites, I can't use @BeforeClass / @AfterClass on the test suite itself. Right now, all I can think of is lazily initialising a static field and stopping the server from a Runtime.addShutdownHook() -- not nice! 回答1: There are

Java 8: What is the equivalent of “UseSplitVerifier”?

家住魔仙堡 提交于 2019-12-07 01:03:11
问题 I'm using Maven 3.2.3 on Mac 10.9.5 and have this for my compiler plugin ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> <compilerArgument>-proc:none</compilerArgument> <fork>true</fork> <!-- <compilerId>eclipse</compilerId>--> </configuration> <executions> <execution> <id>default-testCompile</id> <phase>test-compile</phase> <goals> <goal>testCompile</goal>

How to pass parameters to guicified TestNG test from Surefire Maven plugin?

只谈情不闲聊 提交于 2019-12-06 20:48:24
I'm using Maven + Surefire + TestNG + Guice (latest stable ones) I have "large" test that requires Guice to run. Basically I'm doing it this way: @Test(groups = "large") @Guice(modules = FooLargeTest.Module.class) public class FooLargeTest { public static class Module extends AbstractModule { public void configure() { bindConstant().annotatedWith(FooPort.class).to(5000); // ... some other test bindings } } @Inject Provider<Foo> fooProvider; @Test public void testFoo() { Foo foo = fooProvider.get() // here injection of port is done // it could not be passed to constructor // ... actual test of

No test run when running maven test command

て烟熏妆下的殇ゞ 提交于 2019-12-06 16:26:02
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 type mvn clean test , it shows [INFO] ------------------------------------------------------- [INFO] T

Parallel Test run with cucumber

蓝咒 提交于 2019-12-06 04:20:44
I am currently trying to achieve parallel test run with cucumber. I managed to run two different runners at the same time with the sure-fire plugin. Now I want to check whether is it possible to run SingleRunner file multiple times in parallel. Ex: I have SignUpRunnerTest.java so I need to run this against few platforms parally.Is it possible? This is my Runner file import cucumber.api.CucumberOptions; import cucumber.api.cli.Main; import cucumber.api.junit.Cucumber; import java.util.List; import javax.management.MXBean; import org.junit.Before; import org.junit.Test; import org.junit.runner

Java9 Multi-Module Maven Project Test Dependencies

一个人想着一个人 提交于 2019-12-05 22:27:13
问题 I have a multi-module maven project with three modules core , utils and test-utils Core has the following dependencies definition <dependency> <groupId>my.project</groupId> <artifactId>utils</artifactId> </dependency> <dependency> <groupId>my.project</groupId> <artifactId>test-utils</artifactId> <scope>test</scope> </dependency> I have added Java 9 module-info.java definitions for all three modules and core 's looks like this: module my.project.core { requires my.project.utils; } However I

Maven: Surefire --dry-run?

ぃ、小莉子 提交于 2019-12-05 13:19:08
Is there some way to dry-run surefire? Something which would list wich tests would run, without running them. The goal is, to know which tests (would) run in JBoss AS7 testsuite under certain config. There's a change by Janinko at https://github.com/janinko/maven-surefire/tree/feature/dryrun Which adds this option: -Dtest.dryrun=true Hopefully it will get to upstream. No. If you want to verify you are running a subset of your tests under a particular configuration, you will have to do it after the fact via a surefire report or similar. 来源: https://stackoverflow.com/questions/8012686/maven