I need to create the test case file for datadriver dynamically. For that I am using the config_keyword with datadriver and using Run Only Once to make sure the file is updated only once. I then use pabot to run the tests.
The issue is the keyword after Run Only Once (below, Generate Data For Routing) is executed with every parallel run by pabot.
My code:
Library pabot.PabotLib Library RPA.Dialogs Library DataDriver dialect=excel encoding=UTF-8 ... optimize_pabot=Binary config_keyword=Startup Test Template Route INC # Suite Setup Run Setup Only Once Generate Data For Routing Test Setup Open SNOW Test Teardown End Test Suite Teardown Shutdown Test Timeout 5 minutes *** Test Case *** Route INC NA NA NA NA NA *** Keywords *** Startup [Arguments] ${arguments} **Run Only Once Generate Data For Routing** Wait Until Created resources/E2E_Test_Cases.xlsx 60 ${new_config} = Create Dictionary file=resources/E2E_Test_Cases.xlsx sheet_name=INC # set file attribute in a dictionary [Return] ${new_config} End Test Run Keyword If Test Failed Capture Page Screenshot ${SCREENSHOT_DIRECTORY}/${TASK}.png Close Browser Shutdown Run Keyword And Ignore Error Close All Browsers Generate Data For Routing Log Generate Date file Open SITE Get Active Tasks Generate Routing Map Route INC [Arguments] ...
Command to run in a bat file:
pabot --testlevelsplit --pabotlib --rpa --variable PROD_DEV:%RunType% -d results%runIndex% --name AIR_%runIndex% --log trace.aspx --report report.aspx --loglevel TRACE --splitlog Air.robot