Code Monkey home page Code Monkey logo

robotframework-cookbook's Introduction


robotframework-cookbook

All Contributors

Actions Status License: MIT code style: black Maintenance

A curated list of delicious Robot Framework recipes that will help accelerate the development of test automation scripts, especially for beginner or intermediate level engineers.

If you need help writing Robot Framework scripts or wish to update older scripts to use newer syntax then you have come to the right place. Here we will compile and maintain recipes of working Robot Framework scripts that can be used in your domain.

In the first part of the cookbook there are many simple recipes showing how to use builtin keywords and additional keywords from both internal and external Robot Framework libraries. Towards the back of the cookbook there are complete case studies demonstrating whole projects and test automation solutions.

Other useful resources

Star History

Notes for contributors

Contributions from the wider community are most welcome! Contributions can be either single recipes or whole case studies.

We recommend using Robotidy to help standardise the format of the Robot Framework code.

We also recommend using the Robot Framework Robocop static analysis tool to check your scripts are clean before submission. Robocop can be installed using pip:

$ python -m pip install -U robotframework-robocop

Issues are welcome and you can use them to post ideas for new recipes or report bugs and other observations for exisiting recipes.

For larger submissions simply clone this repository, create a feature branch (or work directly on master) and submit a pull request to merge your branch. If you are not comfortable with Git workflow then simply post your submission on the #cookbook Slack channel and I will help you publish your recipe or case study.

Installation and Usage

Python and Robot Framework must be installed prior to using Robot Framework Cookbook. Download Python and add to PATH during installation, then, use a command-line interpreter of your choice and run the following to install Robot Framework:

$ python -m pip install -U robotframework

You can check if the installation was succesful by running the following command:

$ robot --version

After confirming Robot Framework installation was a success, clone the Robot Framework Cookbook repository by running the following command:

$ git clone https://github.com/adrianyorke/robotframework-cookbook.git

Once the repository has been cloned, you can install relevant libraries by navigating to the tests folder and running:

$ python -m pip install -U -r ./tests/requirements-[version].txt

Table of contents

  1. Standard Library - BuiltIn
  2. Standard Library - Collections
  3. Standard Library - DateTime
  4. Standard Library - OperatingSystem
  5. Standard Library - Process
  6. Standard Library - Remote
  7. Standard Library - String
  8. Standard Library - XML
  9. External Library - REST API
  10. External Library - Databases
  11. External Library - SSH
  12. External Library - Parallel executor for Robot Framework test cases (pabot)
  13. External Library - SeleniumLibrary and SeleniumTestability
  14. External Library - AWSLibrary - for interacting with Amazon Web Services (AWS) Cloud Computing Services
  15. External Library - Robot Framework Browser library powered by Playwright.
  16. Robot Framework 4
  17. Case Studies

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Adrian Yorke
Adrian Yorke

💻 📖 🚧 👀
Tom Purl
Tom Purl

💻 📖
Szabolcs Tóth
Szabolcs Tóth

💻 📖
Jani Mikkonen
Jani Mikkonen

💻 📖
Bartłomiej Hirsz
Bartłomiej Hirsz

💻 📖 🚧 👀
Christoph
Christoph

💻 📖
Mikko Korpela
Mikko Korpela

💻 📖
ericbjones
ericbjones

🎨 💻 📖
Emna Ayadi
Emna Ayadi

📓 💻
Joonas Venäläinen
Joonas Venäläinen

💻
Aleksandra Kowalczyk
Aleksandra Kowalczyk

💻
Martin Škopek
Martin Škopek

💻
sarafurd
sarafurd

📖 🚧
Jeff Choi
Jeff Choi

📖 🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

robotframework-cookbook's People

Contributors

adrianyorke avatar allcontributors[bot] avatar bhirsz avatar chsinger avatar ericbjones avatar jepoy92 avatar joonvena avatar kiblik1 avatar mkorpela avatar olakowalczyk avatar rasjani avatar sarafurd avatar szabolcstoth avatar tompurl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robotframework-cookbook's Issues

Recipe suggestion for chrome driver desired capabilities options

In recent times i have tried downloading pdf files from chrome and got stuck with setting chrome options in robot framework.
Did searched through all possible ways and found the solutions. which took lot of time to understand the syntax in robot.
Please add recipes for different types of driver setup in robot framework with all desired capabilities. it will be lot useful for beginners. Attaching code snippet am using now for reference.

*** Variables ***
${BROWSER}                  chrome
${DOWNLOAD_DIR}             ${CURDIR}/../temp
${REMOTE URL}               http://127.0.0.1:4444/wd/hub
&{OPTION}
&{DESIRED_CAPABILITIES}     name=browserTest    enableVNC=${True}

*** Keywords ***
Login To OMS
    [Documentation]    login for oms
    ${profile}    Create dictionary    enabled=${False}    name=Chrome PDF Viewer
    ${list profile}    Create list    ${profile}
    ${prefs}    Create Dictionary    plugins.plugins_list=${list profile}
    ...    plugins.always_open_pdf_externally=${True}
    ...    download.extensions_to_open=applications/pdf    download.prompt_for_download=${False}
    ...    safebrowsing.enabled=${True}    download.default_directory=/../temp
    ${chrome options}    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys, selenium.webdriver
    Call Method    ${chrome options}    add_experimental_option    prefs    ${prefs}
    Open Browser    ${LOGIN URL}    ${BROWSER}    desired_capabilities=${DESIRED_CAPABILITIES}
    ...    options=${chrome options}

Add an introduction that explains the basic format of a Robot Framework Test Suite

Currently, Cookbook dives straight in with recipes showing how to use keywords from certain libraries but there is no explanation of the basic structure and tables that together form a test suite. Beginners especially might not have enough context to understand even the most basic recipe.

There was also a request on Slack to show what you can do with Metadata in the *** Settings *** section.

We should be careful not to repeat the information contained in the User Guide which covers this in some detail.

Please note, this should not be added to beginning of the Table of Contents section as it will renumber all the proceeding sections and require significant refactoring. Perhaps a new section Introduction before Table of Contents.

Help remove deprecation warning in CI logs: 'Force Tags' is deprecated since Robot Framework version 6.0

The cookbook recipes are all using 'Force Tags' which is now deprecated since RF Version 6.0. Update recipes to use 'Test Tags'.

Robocopy is scanning our recipes each time a change is made in this repo and it had detected this deprecated keyword.

Log message:
/home/runner/work/robotframework-cookbook/robotframework-cookbook/src/section_03/recipe031_handling_dates.robot:12:1 [W] 0319 'Force Tags' is deprecated since Robot Framework version 6.0, use 'Test Tags' instead (deprecated-statement)

Add instructions how to install and use cookbook

I have assumed since the beginning of this project that those interested in Robot Framework - Cookbook know how to clone a github repo, install the required Python libs and run the recipes, but that may not be the case for everybody.

Add Installation and Usage section(s) to README explaining how to set up this repo locally, install packages and execute the Robot Framework recipes.

Also explain that libs can be installed using the relevant requirements*.txt document located in the tests folder.

Recipe required for testing all database views in specified database

Database views should be regularly tested to ensure that they are still functioning. Views are effectively a SELECT statement that queries data from database tables and other views. The underlying tables and join conditions that the view depends on can be modified in a way that breaks existing views if they have not been refactored in line with new db structure.

First, it is necessary to query the database catalog and loop through all database views that exist. For each view discovered, a simple "SELECT TOP 1 * FROM <database_view>;" will be sufficient to check that the view logic is still functioning. This technique should work even if there is no data loaded.

Add list of other primary information sources for beginners

Robot Framework Cookbook may be the first stop for beginners or those new to Robot Framework.

The README should be updated to include links to other primary information sources for beginners so they may explore further.

Examples:

  • Robot Framework Organization
  • Robot Framework User Guide
  • Robot Framework Documentation
  • GitHub

Enforce Black formatting for Python code

All Python code in the project should be formatted using Black code formatter:
https://black.readthedocs.io/en/stable/index.html

Use Black default options, i.e. no overriding recommendations for vertical hanging indents, double-quotes everywhere and maximum line length (88). Also dispay a badge at the top of the main README showing that this project enforces Black code formatting for Python code. Exceptions may be required for Case Study material.

GitHub Actions documentation can be found here:
https://black.readthedocs.io/en/stable/github_actions.html

Recipe 21 is confusing for beginners and does not actually explain use of $ and @

Good feedback on the Slack channel (#cookbook) from Rene.

Recipe 21 mentions that beginners often struggle with the variable prefixes $ and @ and how/what they actually do but recipe 21 itself does not attempt to explain their use. Instead, the recipe just shows the different prefixes being used in a sample script without explanation.

Add explanation of $ and @ prefixes and how they affect the variable usage.

During testing of new CI process a number of errors have been observed

Testing the new CI process has revealed a few errors with missing mandatory variables in recipe 141:

robotframework-cookbook\src\section_14\recipe141_aws_simple_storage_service.robot:18:0 [E] 5504 Missing mandatory '${level}' variable in *** Variables *** section
robotframework-cookbook\src\section_14\recipe141_aws_simple_storage_service.robot:18:0 [E] 5504 Missing mandatory '${category}' variable in *** Variables *** section
robotframework-cookbook\src\section_14\recipe141_aws_simple_storage_service.robot:18:0 [E] 5504 Missing mandatory '${recipe}' variable in *** Variables *** section

Solution:
Add the following variables to Variables table/section in line with all other recipes in cookbook:

${level}
${category}
${recipe}

Add a recipe demonstrating how to create user keywords

We don't currently have any recipes with *** Keywords *** section/table that demonstrate how to create your own user keywords.

For example, in section 9 we could rewrite Recipe 091 Working With Requests Library so we have new keyword Check Github User Exists and Check Github User Does Not Exist

The test case Get Request test case could be rewritten to check several accounts that do exist and several accounts that should not exist.

Fix CI testing for Recipe 15.1

It was necessary to disable CI testing for Recipe 15.1 as there were problems setting geolocation permission. This test has previously worked but something has changed during the last year and CI testing is now failing.

As a professional tester, review recipes and provide feedback.

Cookbook is growing. It would be a good time to review the existing recipes and confirm they are all working. We do have CI running using github actions but external libs change as we saw with robocop earlier this year and this can introduce breaking changes.

Recipe required for database testing

Please add a recipe for interacting with a database. SQLite would be a good choice as it is available in all Python and Robot Framework installations.

For example, it would be useful to inspect the database catalog and confirm certain objects like tables and views exist.

It would also be useful to check the data types of columns to ensure we are using the correct schema in a particular database environment.

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.