Skip to content

Coookiecutter QA let you create QA projects based on the Cookiecutter scaffolding project based on Splinter

License

Notifications You must be signed in to change notification settings

davidemoro/cookiecutter-qa

Repository files navigation

cookiecutter QA

image

image

Coookiecutter QA let you create QA projects based on the Cookiecutter scaffolding project.

Usage

Install Cookiecutter, use cookiecutter-qa as project template and bake your new QA package providing some information:

$ pip install cookiecutter
$ cookiecutter https://github.com/davidemoro/cookiecutter-qa
email [davide.moro@gmail.com]: 
project_name [Project QA]: 
project_slug [project_qa]: 
project_short_description [Project QA contains all the boilerplate you need to create a QA package]: 
version [0.0.1]: 
base_url [https://github.com/davidemoro/cookiecutter-qa]:
selenium_grid_url [http://USERNAME:ACCESS_KEY@hub.browserstack.com:80/wd/hub]: YOUR_SELENIUM_GRID_URL_HERE
pytest_play [y]:
testrail [y]:
$ cd project_qa

As result cookiecutter will create for you a new package with a hello world test pytest, Splinter, pytest-play, BDD and page objects ready.

Important note: be aware that the selenium_grid_url will be saved in project_name/pytest.ini!

And now you can launch your helo world project test (linux):

$ docker run --rm -it -v $(pwd):/src davidemoro/pytest-play

or you are using Windows substitute the $(pwd) command with your project full path.

You can also use custom options provided by pytest and other installed third party plugins or request for custom browser capabilities. For example:

$ docker run --rm -it -v $(pwd):/src davidemoro/pytest-play \
    --variables capabilities/os/WIN10.json
    --variables capabilities/browsers/chrome/CHROME.json
    --variables capabilities/resolutions/1280x1024.json
    -x
    --pdb

Local browsers testing is supported too (covered in next sections).

Setup

Prerequisites:

  • python >= 3.6, needed for the scaffolding tool
  • cookiecutter scaffolding tool for generating your project (pip install cookiecutter command)
  • docker, suggested method for executing your tests using the well tested https://github.com/davidemoro/pytest-play-docker container. Using docker is the easiest and faster solution for running your tests
  • a selenium grid url or geckodriver/chromedriver installed

Browsers setup and selenium_grid_url

If you are not yet comfortable with geckodriver/chromedriver installations, PATH environment variable update I suggest to start creating a BrowserStack free account and you will be able to run your tests against a real remote browser without having to install locally all the needed prerequisites.

Once logged in on BrowserStack visit Account > Settings, copy the Automate's username and access key and generate a new cookiecutter project providing the remote selenium grid url following the format:

http://USERNAME:ACCESS_KEY@hub.browserstack.com:80/wd/hub

You can use any Selenium grid provider (SauceLabs, BrowserStack, TestingBot) or using your own local grid with Zalenium.

Otherwise local browsers testing is supported too thanks to the option splinter-webdriver, read the following section.

Run tests with local browsers

You can launch tests based on local browsers instead of relying to a remote (SauceLabs, BrowserStack, TestingBot) or local grid (using Zalenium) using the --splinter-webdriver firefox option for example.

See https://github.com/pytest-dev/pytest-splinter#command-line-options

Supported browser options:

  • firefox
  • remote (you need to provide a value for the --splinter-remote-url option)
  • chrome

Using local browsers it's up to you the configuration of geckodriver, chromedriver, executable path settings, using the latest drivers (eg: https://github.com/mozilla/geckodriver/releases) and updated browser versions.

pytest-play ready!

cookiecutter-qa supports also pytest-play including by default all the third party external plugins like play_selenium, play_requests and their brothers (see Third party pytest-play plugins) so you can execute plain yaml files.

Credits

Twitter

cookiecutter-qa tweets happens here:

Based on

image

Sponsored by

Browserstack

About

Coookiecutter QA let you create QA projects based on the Cookiecutter scaffolding project based on Splinter

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published