目录
First, let’s see the office demos
Second, use ruamel.yaml to get yaml contents
Third, generate robot test cases
First, let’s see the office demos
- set suite name
- import library
- create a test case
- named tags
- create one test steps
- assert env var
from robot.api import TestSuite
from robot.api import ResultWriter
from robot.conf import RobotSettings
suite = TestSuite('Activate Skynet')
suite.resource.imports.library('OperatingSystem')
test = suite.tests.create('Should Activate Skynet', tags=['smoke'])
test.keywords.create('Set Environment Variable', args=[
'SKYNET', 'activated'], type='setup')
test.keywords.create('Environment Variable Should Be Set', args=['SKYNET'])
Second, use ruamel.yaml to get yaml contents
- Get yaml contents and change to python object
- Get config object
- Get testcases object
Third, generate robot test cases
- Create a new suite with name
- Import loibrarys into suite
- Create a new test case with name and tags
- Create steps(Include assertions) for case
At last, run and get reports
Yaml Example
References
- Use RobotSettings
- Useful links
- Suite import library
Requirements.txt
- robotframework
- ruamel.yaml