Hi, I’m a beginner; created a test suite that I want to execute for multiple roles; and based on the role, locators change, how can I achieve this?
current test project setup is as follows:
Test Project
DataDriver uses the Listener Interface Version 3 to manipulate the test cases and creates new test cases based on a Data-File that contains the data for Data-Driven Testing. These data file may be .csv , .xls or .xlsx files.
If you set the folders & files up as below, you should be able to run this & change the ${ROLE} variable from standard to administrator & see the output change.
You could consider housing the variable in a passed-in command-line variable to the robot call, or in a *.toml file profile etc. (changeable for the whole project from 1 place)
This uses the DataDriver library. Please ensure to run pip install --upgrade robotframework-datadriver & see here for more info on that: robotframework-datadriver · PyPI
test/data_driven_test_case.robot file: *** Variables *** ${ROLE} standard*** Settings *** Library DataDriver ../test_data/test_data_${ROLE}_role.csv Test Template Log data found in data file*** Test Cases *** Login with user ${username}and password${password} DefaultUsername DefaultPassword*** Keywords *** Log data found in data file [Arguments] ${username} ${password} Log "DATA FOUND: username '" ${username} "'' & password '" ${password} "'"