Giter Site home page Giter Site logo

lipq1 / robotframework-templateddata Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bhirsz/robotframework-templateddata

1.0 0.0 0.0 39 KB

Robot Framework library for generating test data from templates

License: Apache License 2.0

Python 55.43% RobotFramework 44.57%

robotframework-templateddata's Introduction

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

robotframework-templateddata's People

Contributors

bhirsz avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.