Forum Discussion

Cekay's avatar
Cekay
Contributor
5 years ago
Solved

SoapUI Maven Starting Test with specific tags

Hello everyone,

 

I know this question is asked often but I can'f find an answer.

I would like to run TestSuites with special tags based on the enviroment. I know there are groovy scripts but I don't like those solutions.

 

https://support.smartbear.com/readyapi/docs/integrations/maven/config.html#config

tags

Specifies the tags of the test cases to be run.
Use the following syntax:
<param>TestCase tag1, tag2</param>

 

If i understand this correctly, I can specify my tag in my maven goals but do I have to specify this tag for each TestCase or is there a way to use a tag for all Suites?

like

<testSuite>${testSuite} Integration</testSuite>

All my attempts didn't work so far, so maybe someone can help me please?

My tags are called

- Integration

- Test

 

Cheers

Cekay

 

---

 

Part of my pom.xml if needed:

 

<configuration>
<!--<globalProperties> <value>preemptive=true</value> </globalProperties> -->
<projectFile>flexibill_project</projectFile>
<printReport>false</printReport>
<outputFolder>${project.build.directory}/soapui</outputFolder>
<junitReport>true</junitReport>
<exportAll>true</exportAll>
<environment>Integration</environment>
<readyApiProperties>
<property>
<name>soapui.logroot</name>
<value>${project.build.directory}/soapui-logs/</value>
</property>
</readyApiProperties>
<testSuite>${testSuite}</testSuite>
<testCase>${testCase}</testCase>
</configuration>

3 Replies

  • Cekay's avatar
    Cekay
    Contributor

    Oki I think I was able to find almost the answer. There is just one small problem left, whereI need help

    As you can see below testSuite and testCase can be empty and everything will be executed.

    If I try the same for the tags I get NPE in Maven.

     

    So is there a way to keep this "<tags><param>${useTag}</param></tags>" empty?

     

     

    My pom looks now like this:

     

    <configuration>
    <!--<globalProperties> <value>preemptive=true</value> </globalProperties> -->
    <projectFile>flexibill_project</projectFile>
    <printReport>false</printReport>
    <outputFolder>${project.build.directory}/soapui</outputFolder>
    <junitReport>true</junitReport>
    <exportAll>true</exportAll>
    <readyApiProperties>
    <property>
    <name>soapui.logroot</name>
    <value>${project.build.directory}/soapui-logs/</value>
    </property>
    </readyApiProperties>
    <environment>${env}</environment>
    <testSuite>${testSuite}</testSuite>
    <testCase>${testCase}</testCase>
    <tags><param>${useTag}</param></tags>
    </configuration>

     

     

     

    Run 1 testsuite, run testCases tagged with "Test" on enviroment "Test" :smileyhappy:

     

    mvn clean test -Denv="Test" -DtestSuite="NAME_testSuite" -DuseTag="TestCase Test"

     

     

    Start all testSuites, run testCases tagged with "Test" on enviroment "Test" :smileyhappy:

     

    mvn clean test -Denv="Test" -DuseTag="TestCase Test"

     

    Start all testSuites, run all active testCases on enviroment "Integration" :womanfrustrated:

    mvn clean test -Denv="Integration"

    Response:

    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  2.203 s
    [INFO] Finished at: 2019-05-06T14:27:33+02:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal com.smartbear:ready-api-maven-plugin:2.6.0:test (default) on project flexibill-soapui-tests: Execution default of goal com.smartbear:ready-api-maven-plugin:2.6.0:test failed.: NullPointerException -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

     

    Thank you

    Cekay

      • Cekay's avatar
        Cekay
        Contributor

        Thank you.

         

        I use following workaround : all Testcases got the tag "Integration"

         

        and I use following commands

        • mvn clean test -Denv="Integration" -DuseTag="TestCase Integration"
        • mvn clean test -Denv="Test" -DuseTag="TestCase Test"