简体   繁体   中英

Is there a conftest.py pytest equivalent on Robot Framework

in pytest framework conftest.py allows to setup test environment before any test execution starts. Like Reading command line arguments, setting up UUT, configure logger etc. How to do similar things in Robot Framework.

So My objective is to have a common code which will get executed before executing any of the test suite

You have 3 options:

  1. use "suite setup" in settings table. Suite setup will execute given keyword before current test suite. More in documentation .

  2. If you need to execute certain keyword before all test suites, add in a test suites directory an __init__.robot file with settings table there. Execute then whole test suites directory, not specific files. To narrow down executed test suites, use -s parameter. More info in documentation .

  3. Use ROBOT_OPTIONS environmental variable - this automaticaly adds command line parameters to pybot (robot) script. For available options, look at documentation . More info on init file also is in the documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM