项目作者: laurentbristiel

项目描述 :
Robot Framework Faker library example
高级语言: RobotFramework
项目地址: git://github.com/laurentbristiel/robotframework-faker-example.git
创建时间: 2015-02-02T09:58:04Z
项目社区:https://github.com/laurentbristiel/robotframework-faker-example

开源协议:Apache License 2.0

下载


Robot Framework Fakerlibrary Examples

GitHub Actions

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

    • python3 -m pip install robotframework
    • python3 -m 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:

  1. *** Test Cases ***
  2. Faker_profile
  3. ${address} = FakerLibrary.address
  4. ${country} = FakerLibrary.country
  5. ${email} = FakerLibrary.email
  6. ${first_name} = FakerLibrary.first_name
  7. ${last_name} = FakerLibrary.last_name
  8. ${phone_number} = FakerLibrary.phone_number
  9. ${profile} = Catenate
  10. ... ${\n}=======================================
  11. ... ${\n}first_name: ${first_name}
  12. ... ${\n}last_name: ${last_name}
  13. ... ${\n}address: ${address}
  14. ... ${\n}country: ${country}
  15. ... ${\n}email: ${email}
  16. ... ${\n}phone_number: ${phone_number}
  17. ... ${\n}=======================================
  18. Log To Console ${profile}

will produce an output similar to this:

  1. $ robot --test user_profile faker-example.robot
  2. =======================================
  3. Faker-Example
  4. =======================================
  5. Faker_profile .......
  6. =======================================
  7. first_name: Trevon
  8. last_name: Nader
  9. address: PSC 4099, Box 8542
  10. APO AE 43357
  11. country: Tokelau
  12. email: renner.bridgette@greenholt.info
  13. phone_number: 484.461.9307x600
  14. =======================================
  15. Faker_profile | PASS |
  16. ---------------------------------------

or to that:

  1. $ robot --test user_profile faker-example.robot
  2. =======================================
  3. Faker-Example
  4. =======================================
  5. Faker_profile .......
  6. =======================================
  7. first_name: Sara
  8. last_name: Gaylord
  9. address: PSC 2996, Box 3404
  10. APO AA 22214
  11. country: Cook Islands
  12. email: luca99@yahoo.com
  13. phone_number: 250.723.9835x7058
  14. =======================================
  15. Faker_profile | PASS |
  16. ---------------------------------------