Issue
We have created a selenium project to run functional test. We have smoke suite, functional suite and regression suite available. In my pom file, I parameterized the xml suite name and pass the suite name to run in command line as below.
pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
In command line I can give which suite to run as below.
mvn clean test -Dsurefire.suiteXmlFiles=regression.xml
Now I have created a Azure DevOps pipeline to run my test. In yaml file, I have added below part to run the pom.xml.
steps:
- task: Maven@3
inputs:
mavenPomFile: './pom.xml'
But how can I mention in yaml file, which suite to run with the pipeline?
Solution
How can I mention in yaml file, which suite to run with the pipeline?
You can define the parameters value in the options field in Maven task.
For example:
- task: Maven@3
displayName: 'Maven pom.xml'
inputs:
mavenPomFile: './pom.xml'
goals: 'test'
options: 'test -Dsurefire.suiteXmlFiles=regression.xml'
For more info, you can refer to this doc about maven task.
Answered By - Kevin Lu-MSFT
Answer Checked By - Robin (JavaFixing Admin)