Forum Discussion

fedsierra's avatar
fedsierra
Frequent Visitor
7 years ago

Maven run only certain tags

Hello,

 

Is there a way to specify in the pom.xml or by command line a set of diffent tags and only run those using maven?

 

The current pom.xml config is running ALL the test cases.

 

relevant part of the pom.xml

 

<executions>
					<execution>
						<phase>test</phase>
						<goals>
							<goal>test</goal>
						</goals>
						<configuration>

							<!-- Adding SoapUI Properties -->
							<soapuiProperties>
							
							<!--Global Properties -->
								<property>
									<name>soapui.properties</name>
									<value>${env.name}</value>
								</property>
								
							<!--Project Properties-->	

								<property>
									<name>soapui.properties.TestHarness</name>
									<value>${project.basedir}/project.properties</value>
								</property>

							</soapuiProperties>


							<!-- Replacing property for release Version-->
							<projectProperties>
								<projectProperty>APIVersion=${env.RELEASE_BRANCH}</projectProperty>
							</projectProperties>

							<projectFile>${project.basedir}/TH-soapui</projectFile>
							
							<tags><param>TestCase setup,save</param></tags>
																																			                         							
							<outputFolder>${project.basedir}/target/surefire-reports</outputFolder>
							<junitReport>true</junitReport>
							<exportAll>true</exportAll>
							<printReport>true</printReport>
							<reporting>
								<plugins>
									<plugin>
										<groupId>org.apache.maven.plugins</groupId>
										<artifactId>maven-surefire-report-plugin</artifactId>
										<version>2.19.1</version>
										<configuration>
											<argLine>-Xms1024m -Xmx2048m -XX:MaxPermSize=2048m</argLine>
										</configuration>
									</plugin>
								</plugins>
							</reporting>
							
							<argLine>-Xms1024m -Xmx2048m -XX:MaxPermSize=2048m</argLine>
						</configuration>
					</execution>
				</executions>

1 Reply

  • Debz's avatar
    Debz
    Contributor

    Tags weren't existing when the project we have was created. I think what my coworkers used was Groovy script. Then they added property lines in the project file (.xml), not in the pom file. Set the property name to match the environment name. afterwards. the value will be the test case names that you want to run separated by commas. 

       <con:property>
            <con:name>"Environment Name"</con:name>
            <con:value>"Test Case 1","Test Case 2"</con:value>
       </con:property>

    Maybe there's a way to manipulate this to be able to use for tags. I'm not that familiar with the Groovy part yet though.