Forum Discussion

soapuiUser123's avatar
soapuiUser123
New Contributor
13 years ago

How to run subset of test cases or test suites using Maven

Hi,

Is there a way to define subset on test cases or test suites in pom file to execute the bunch using maven ( mvn test or mvn site).
I tried couple of ways but couldn't succeed.
1] Method -
<testCase>test case 1</testCase>
<testCase>test case 2</testCase>

but it would only execute the last one.

2] Method -
<testCases>
<testCase>test case 1</testCase>
<testCase>test case 2</testCase>
</testCases>

but this just gets ignored by the eviware:soapui:test plugin, may be due to no such setting as <testCases> defined in the plugin.

Can someone please help. I am using the pom as defined here --> http://soapui.org/Test-Automation/maven-2x.html and able to run entire project or single test case or single test suite but not a subset of them.

Thanks.
  • pramos's avatar
    pramos
    New Contributor
    I have the same problem.
    Anyone have a suggestion?
  • pramos's avatar
    pramos
    New Contributor
    Ok, but to run multiple TestCases I need also to declare the TestSuite in the pom?

    Like this:

    execution 1
    <testSuite>test suite 1</testSuite>
    <testCase>test case 1</testCase>

    execution 2
    <testSuite>test suite 1</testSuite>
    <testCase>test case 2</testCase>
    .
    .
    .
    execution n
    <testSuite>test suite 1</testSuite>
    <testCase>test case n</testCase>
  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    pramos
    I've just checked the Soapui source code, you have the choice to set the testSuite or not

    If you only set the testCase, all test cases with this name in the project will be runned.
    If you also set the testSuite, only test cases with the providing name that belongs to the given testSuite will be runned. This can be usefull if you have test with the same names in the project.

    Is that clearer?
  • Debz's avatar
    Debz
    Contributor

    Hi! 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>