Robot Framework library for generating test data from templates
Project description
TemplatedData
Introduction
TemplatedData is Robot Framework library for dynamically generated test data using robot variables and Jinja templating.
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`
Return value can be either text/string (default) or json.
Test data:
{ "key": "${var}" }
Robot code:
${data} Get Templated Data From Path test_data.txt var=value return_type=json Log ${data} # it should print `{ "key": "value" }` and ${data} will be of type json
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
File details
Details for the file robotframework-templateddata-1.3.0.tar.gz
.
File metadata
- Download URL: robotframework-templateddata-1.3.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28d450abd99b446d392cdbbee2c9ce38bf9f61da577fbb1e230a3bcc83a86ad7 |
|
MD5 | 3255d814cd663bf1fa82bd4965ddbe79 |
|
BLAKE2b-256 | e421a8a709fa0f774fde8b77a8403c35402d5a600053b2f17ea1f5399c6c6f3d |
Provenance
File details
Details for the file robotframework_templateddata-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: robotframework_templateddata-1.3.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a78327ef30e2535747ea77df7b4541f8584d6655ddc37ce95a2873ef75366039 |
|
MD5 | cb093e904cd64b72a7722795e8796a9a |
|
BLAKE2b-256 | c1e802493a7ae9a99575ea2c821c55e69fe38d063454bac2fe82c21a3806aca7 |