Don't configure your Pom to do this. Use parameterized tests or JUnit theories.
On Monday 18 April 2016, Maple Wang <maple.feng.w...@hotmail.com> wrote: > Hi, > > > We want to execute one test case several times in maven test, each time we > will give it different input. First thought in my head is using profile to > handle it. when I use "mvn test -Dmultiple=true", I expect that test1&test2 > are both exectued in maven test. But the truth is that surefire will not > execute any of them, the log is following: > > > [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ yamltest --- > [INFO] > [INFO] --- maven-surefire-plugin:2.12.4:test (test1) @ yamltest --- > [INFO] Skipping execution of surefire because it has already been run for > this configuration > [INFO] > [INFO] --- maven-surefire-plugin:2.12.4:test (test2) @ yamltest --- > [INFO] Skipping execution of surefire because it has already been run for > this configuration > > > my pom is as below: > > > <profiles> > <profile> > <id>profile1</id> > <activation> > <property> > <name>multiple</name> > <value>true</value> > </property> > </activation> > <properties> > <profile.arguments> > -DmyArg=myArg1 > </profile.arguments> > </properties> > <build> > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-surefire-plugin</artifactId> > <version>2.12.4</version> > <executions> > <execution> > <id>test1</id> > <phase>test</phase> > <goals> > <goal>test</goal> > </goals> > </execution> > </executions> > <configuration> > <argLine>${profile.arguments}</argLine> > <includes> > <include>Test.java</include> > </includes> > </configuration> > </plugin> > </plugins> > </build> > </profile> > <profile> > <id>profile2</id> > <activation> > <property> > <name>multiple</name> > <value>true</value> > </property> > </activation> > <properties> > <profile.arguments> > -DmyArg=myArg2 > </profile.arguments> > </properties> > <build> > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-surefire-plugin</artifactId> > <version>2.12.4</version> > <executions> > <execution> > <id>test2</id> > <phase>test</phase> > <goals> > <goal>test</goal> > </goals> > </execution> > </executions> > <configuration> > <argLine>${profile.arguments}</argLine> > <includes> > <include>Test.java</include> > </includes> > </configuration> > </plugin> > </plugins> > </build> > </profile> > </profiles> > > > so anyone can tell me how should I configure my pom to achieve my > requirement? thanks in advance. > > best regards. > > > -- Sent from my phone