how to mention tags in robotframework while writing scripts

16 views Asked by At

when we write test cases in the robot framework how to add test cases under the specific tag.

I want to know how to use tags in robot framework and how to define it ,how to add specic test cases under specic tag and to execute the particular test cases using tags.

1

There are 1 answers

0
Helio On

As you can read in the excellent Robot Framework User Guide, at this section, you can define tags at Test Suite level or at Test Case level. For example:

*** Settings ***
Test Tags        this_is_suite_tag
*** Test Cases ***
My Test Case
    [Tags]   this_is_test_tag
    Log to Console   This is just an example

To use them, you can run with the options --include or --exclude. For example, this would work:

robot --include this_is_test_tag  the_name_of_test_suite_file.robot

And this would cause an error if no other test case would be selected to run:

robot --exclude this_is_test_tag  the_name_of_test_suite_file.robot

The Robot Framework IDE (RIDE) handles this tags in an easy way, and it may help in your beginner learning path.