Skip to content

Latest commit

 

History

History
101 lines (76 loc) · 3.44 KB

File metadata and controls

101 lines (76 loc) · 3.44 KB

Allure testplan for Robot Framework tests

You can filter Robot Framework test cases by an ID or by a name with an allure testplan.

  1. Create a testplan file.
  2. Set the ALLURE_TESTPLAN_PATH environment variable to the testplan path.
  3. Run the Robot Framework with the allure_robotframework.testplan pre-run modifier.

Creating a testplan

Lets say, we have the following Robot Framework test data in the testplan.robot file:

*** Test Cases ***
Selected by Name
    No Operation

Selected by ID
    [Tags]  allure.id:1008
    No Operation

Not Selected
    [Tags]  allure.id:1009
    No Operation

And we want to select only two test cases:

  1. The test case Selected by Name.
  2. The test case with ID 1008.

To achieve that, we need the following testplan (lets say, we put it in the testplan.json file):

{
    "version":"1.0",
    "tests": [
        {
            "selector": "Testplan.Selected by Name"
        },
        {"id": "1008"}
    ]
}

Setting the ALLURE_TESTPLAN_PATH environment variable

Refer to the docs on the environment you are working in on how to set up an environment variable.

If you are working in Linux or MacOS and use bash or a similar shell, the most convinient way is to put ALLURE_TESTPLAN_PATH=./testplan.json before the robot command, or use the export ALLURE_TESTPLAN_PATH=./testplan.json statement.

If you are using PowerShell, set up the variable with the $Env:ALLURE_TESTPLAN_PATH = "./testplan.json" statement.

Running the Robot Framework

The following example shows how to execute the abovementioned test cases with the testplan enabled (this is for Linux, bash; if you are using another OS/Shell, the invocation may looks differently):

ALLURE_TESTPLAN_PATH=./testplan.json robot --log NONE --report NONE --output NONE --extension robot --loglevel DEBUG --listener allure_robotframework:./allure-results --prerunmodifier allure_robotframework.testplan ./testplan.robot

The test cases, listed in the plan, will be executed:

==============================================================================
Testplan
==============================================================================
Selected by Name                                                      | PASS |
------------------------------------------------------------------------------
Selected by ID                                                        | PASS |
------------------------------------------------------------------------------
Testplan                                                              | PASS |
2 tests, 2 passed, 0 failed
==============================================================================
Output:  None

You can read more about the CLI arguments here: the Robot Framework command line options.