Skip to main content

Robot Framework library for generating test data from templates

Project description

PyPI - License

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

robotframework-templateddata-1.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file robotframework-templateddata-1.1.0.tar.gz.

File metadata

  • Download URL: robotframework-templateddata-1.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for robotframework-templateddata-1.1.0.tar.gz
Algorithm Hash digest
SHA256 722fea573c28b94a311642fcda17bf67b517de6af41c9c77f44aab5ab97730b9
MD5 7f4bef75077cc5eaf2fbdde0df6ff5d4
BLAKE2b-256 e5999cd2a2053ed3bcf84a99bc13f414207b60e93949897d4b366bd65c1f6a37

See more details on using hashes here.

Provenance

File details

Details for the file robotframework_templateddata-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: robotframework_templateddata-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for robotframework_templateddata-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a1878d994235975715e087abeba9a7ed6369cb1ddfbe79fd87a19aba7c79cde
MD5 667a74e823fe21337269f2a3370a4b03
BLAKE2b-256 544ab70652f32b47826f8a3d115c1d7a8c6d64bed68c6d06c57f6af0ad2ce0b1

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page