Skip to content

laurentbristiel/robotframework-faker-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robot Framework Fakerlibrary Examples

Build Status

Set of examples of Robot Framework Faker Library usage.

This library generates random data to be used in test cases.

Resources for the library:

Usage:

  1. install Robot Framework and RF Faker Library

    • pip install robotframework
    • pip install robotframework-faker
  2. launch Robot tests

    • whole suite: robot faker-example.robot
    • specific test: robot --test country_locale faker-example.robot

For example, this test:

    *** Test Cases ***
    Faker_profile
        ${address} =  FakerLibrary.address
        ${country} =  FakerLibrary.country
        ${email} =  FakerLibrary.email
        ${first_name} =  FakerLibrary.first_name
        ${last_name} =  FakerLibrary.last_name
        ${phone_number} =  FakerLibrary.phone_number
        ${profile} =  catenate
        ...             ${\n}=======================================
        ...             ${\n}first_name: ${first_name}
        ...             ${\n}last_name: ${last_name}
        ...             ${\n}address: ${address}
        ...             ${\n}country: ${country}
        ...             ${\n}email: ${email}
        ...             ${\n}phone_number: ${phone_number}
        ...             ${\n}=======================================
        log to console  ${profile}

will produce an output similar to this:

$ robot --test user_profile faker-example.robot
=======================================
Faker-Example
=======================================
Faker_profile                   .......
=======================================
first_name: Trevon
last_name: Nader
address: PSC 4099, Box 8542
APO AE 43357
country: Tokelau
email: renner.bridgette@greenholt.info
phone_number: 484.461.9307x600
=======================================
Faker_profile                  | PASS |
---------------------------------------

or to that:

$ robot --test user_profile faker-example.robot
=======================================
Faker-Example
=======================================
Faker_profile                   .......
=======================================
first_name: Sara
last_name: Gaylord
address: PSC 2996, Box 3404
APO AA 22214
country: Cook Islands
email: luca99@yahoo.com
phone_number: 250.723.9835x7058
=======================================
Faker_profile                  | PASS |
---------------------------------------

About

Robot Framework Faker library example

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published