We just started using Robot Framework using Eclipse and Maven. We want to run only certain test suites(test suites will have testcases).Is there any way to do that?
Here is how you can select which robot tests you want to execute, when using maven.
Maven's pom.xml file looks like this:
....
<properties>
<suite.test />
<include.tag />
<exclude1.tag></exclude1.tag>
<exclude2.tag></exclude2.tag>
<exclude3.tag > EXCLUDE </exclude3.tag>
....
</properties>
....
<build>
<plugins>
<plugin>
<groupId>org.robotframework</groupId>
<artifactId>robotframework-maven-plugin</artifactId>
<configuration>
<suites>
<suite>${suite.test}</suite>
</suites>
<includes>
<tag>${include.tag}</tag>
</includes>
<excludes>
<tag>${exclude1.tag}</tag>
<tag>${exclude2.tag}</tag>
<tag>${exclude3.tag}</tag>
</excludes>
.....
</configuration>
....
</plugin>
.....
</plugins>
.....
</build>
Without command line options, all tests suites are executed, except the ones tagged with EXCLUDE:
mvn robotframework:run
Command line options can be added to fine tune which testsuites are executed. This command only executes the test suite named PerformanceSuite
mvn robotframework:run -Dsuite.test=PerformanceSuite
This command executes all test suites except the ones tagged with EXCLUDE (default behavior) and the ones tagged with "DEMO" or "SAMPLE"
mvn robotframework:run -Dexclude1.tag=DEMO -Dexclude2.tag=SAMPLE
This command runs only tests suites tagged with "SERVER" but excludes the ones taged with SAMPLE:
mvn robotframework:run -Dinclude.tag=SERVER -Dexclude1.tag=SAMPLE
Remember that tags are (recursively) inherited, in the current test-suite from the parent test suite.
There are no pybot options to exclude suites, other than to not include them on the command line in the first place. That being said, you have a couple of options to accomplish the same thing.
The first option is to give all your tests tags, and then use the --exclude
option to exclude tests with particular tags. For example, in my organization we use robot for both automated and manual tests. When we run in an unattended fashion we will exclude all of the test cases with the manual
tag.
If that is impractical, your other option is to enumerate the suites that you do want to run. This is tedious, but is made easier if you use an argument file. For example, you can create a file with the following contents:
--suite fullsuite.subsuite1
--suite fullsuite.subsuite3
--suite fullsuite.subsuite4
If you save it to a file named "skip2.args" you can then reference this on the command line with the --argumentfile
option. For example:
pybot --argumentfile skip2.args ./fullsuite
You can combine these two techniques. For example, to skip "subsuite2" and also skip all tests tagged as manual, you can simply add the --exclude
option to the .args file:
--suite fullsuite.subsuite1
--suite fullsuite.subsuite3
--suite fullsuite.subsuite4
--exclude manual
For more information on command line options you can type pybot --help
at the command line, or see the section All command line arguments in the robot framework user guide.