Robot Framework library for generating test data from templates
Project description
TemplatedData
Introduction
TemplatedData is Robot Framework library for dynamically generated test data using on robot variables and Jinja templating. Check tests/test.robot in repository to see and run usage examples.
Requirements
Python 3.6+ and Robot Framework 3.2.1+.
TemplatedData will most likely work on other versions but it’s not tested on them.
Installation
You can install TemplateData by running:
pip install robotframework-templateddata
Usage
You need to import TemplatedData as library first:
*** Settings *** Library TemplatedData
TemplatedData will replace all occurences of robot variables (${var}) in file or variable using current robot context and scopes. All test data in below examples are saved under ‘test_data.txt’ files
Test data:
my variable is ${var}
Robot code:
${var} Set Variable ${10} ${data} Get Templated Data From Path test.data.txt Log ${data} # it should print `my variable is 10`
If the variable is not found it will be replaced with empty string. You can override that behaviour:
${data} Get Templated Data From Path test.data.txt default_empty=${5} Log ${data} # it should print `my variable is 5`
You can also set default value of variable with : symbol.
Test data:
my variable is ${var} and ${var2:some string}
Robot code:
${var} Set Variable ${10} ${data} Get Templated Data From Path test.data.txt Log ${data} # it should print `my variable is 10 and some string`
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for robotframework-templateddata-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfe89d183c0574db861a968acdd5fbaf1b7364738a29c8060f601bcb25946413 |
|
MD5 | da7ccd99cd4b0fe392459fd6623ad634 |
|
BLAKE2b-256 | c029a14e1c2d0b967f3b2a86bfdab325b5ddfd9789a4bc4ecc41d13a23780573 |
Hashes for robotframework_templateddata-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e21de418fe8d7ab0afffb54f0cb7a96cabdea15e698d2461b2b05dc8cbf3b36b |
|
MD5 | 847d95f289b7ccb591caf0b623ef9b66 |
|
BLAKE2b-256 | 1864c58bd34bdcec3ef9e8f7067cc196bcfedd23750f7bd92b0babd92a97cd53 |