How to skip a specific test file in the Robot platform?

In my robot script, only 10 test files are defined in the TEST Cases section. Test1 is independent and should not run all the time; a single execution is enough.

Please indicate if there is a keyword that only passes testcase1 .

However, if the user is interested in running a script, including testcase1 , then the user should specify the command as something like pybot <scriptname> "add testcase1" .

 testcase1 .... .... testcase2 .... .... testcase3 .... .... testcase10 .... .... 
+6
source share
1 answer

There is no keyword to pass the test. If at runtime you need to determine whether to run the test or not, then your only choice is to immediately knock it down or make it pass without any other work. Robot just doesn't support test failures after running tests

However, there is a command line option that allows you to skip tests by tag. This is a very powerful feature of the robot. For more information, see Test Case Selection in the Robot Platform User Guide.

For example, consider the following test suite:

 *** Test Cases *** | Test case 1 | | [Tags] | run-once | | log | this is test case 1 | Test case 2 | | log | this is test case 2 

To run all the tests, you will do the following:

 $ pybot example.robot 

If you want to skip the first test, you can use the --exclude option:

 $ pybot --exclude run-once example.robot 

If you want to run only the first test, you can explicitly enable it, which will run only those tests that have this tag:

 $ pybot --include run-once 
+6
source

Source: https://habr.com/ru/post/976742/


All Articles