GithubHelp home page GithubHelp logo

headpin.auto's Introduction

This is the automation testing framework for CloudForms, including SystemEngine, CloudEngine and upstream projects Katello, Aeolus and Headpin:

This test framework was originally written for Katello and headpin, and extended by the Red Hat CloudForms QE Integration team. Tests use Mozilla's pytest-mozwebqa plugin.

Documentation

Current documentation is hosted here.

Dependencies and Installation

  • selenium webdriver or selenium server
  • pytest==2.2.3
  • pytest-xdist==1.6
  • pytest-mozwebqa==0.7.1
  • unittestzero

Clone this project and install dependencies. Dependencies may be installed by running pip-python install -r ./requirements.txt from the root of the project. A customized dataset may be generated by editting data/template_data.py and then executing generate_dataset.py.

Requirements

These tests assume a fresh install of the product(s) that are accessible from the machine running the tests.

Executing Tests

There are two ways to run Selenium tests.

  1. Use the Selenium WebDriver. Executing the tests with argument --driver=firefox allows for simple test runs. This is the method most commonly used during development.
  2. Use the Selenium Server. Running a standalone Selenium Server supports test distribution on multiple hosts.

To start the Selenium Server for local testing: java -jar /path/to/your/selenium/selenium-X.Y.jar \ -firefoxProfileTemplate /path/to/ff_profile/.mozilla/firefox/[profile]/

See Selenium documentation for more details.

Basic Usage

py.test --driver=firefox --baseurl=https://<FQDN>/conductor|katello --project=[project] -q testdir/path/my_test_file.py

Options

  • --driver=firefox Allows tests to be run without a separate Selenium server running.
  • --baseurl=... FQDN of product under test. Include /conductor or /katello
  • --product=katello|aeolus|sam|cfse|cfce Specify product under test.
  • -k [test_keyword] Test keyword to run specific tests.
  • -m <marker> For running tests tagged with py.test markers.

See py.test documentation for more information.

Development Notes

About the Files

[project]/tests/test_file.py Test code goes here.

pages/page.py Setup methods to use throughout the page objects. By inheritance these methods are accessible in other page objects. It is important not to include locators or site specific functions in this file. Generally the functions in this file are common across our projects and don't change often.

pages/base.py Page object helper functions that are global across the whole site.

[project]/pages/my_page.py This is a page object file that represents a page on the website. Page-specific methods go here. It inherits the base.py class and inturn all of the methods that base.py has access to.

api/ API helper methods.

credentials.yaml Not currently in use. Store the credentials to log into the site with. The mozwebqa plugin will parse this file and make the values available inside the tests.

conftest.py Specify custom command-line options.

mozwebqa.cfg The mozwebqa plugin will read the parameters in this file and automatically add them onto the py.test command line. It is handy for parameters that are constant like --browsername=firefox

generate_dataset.py Standalone script to generate semi-random data file. Data derived from lists in data/template_data.py.

data/large_dataset.py Dataset generated from generate_dataset.py.

data/private_data.ini Private cloud provider credentials. Update before running provider tests.

data/manifests/ Content provider manifest.zip files.

requirements.txt Lists required packages. Running sudo pip install -r requirements.txt (Mac/Linux) will automatically download and install the packages in this file. We recommend 'pinning' the packages to a specific version, for example pytest==2.1.3. This decreases the chance that a change to py.test will affect your test suite.

Interactive Test Development

Developing Selenium tests is tricky and requires some trial and error. Launching a whole test just to see if your last code edit works takes a long time. A quicker way is to use the interactive Python shell (or even better, IPython for auto-complete) to start an interactive webdriver session.

$ python
>>> from selenium import webdriver
>>> url = 'https://myUrl/aeolus'
>>> driver = webdriver.Firefox()
>>> driver.get(url)

A Firefox browser window should open to the URL. You can now interact with the new browser window (login, nav to page you're working on, inspect elements). Then try a locator and see if it works.

>>> driver.find_elements_by_css_selector('li#promotions')
>>> [<selenium.webdriver.remote.webelement.WebElement at 0x1a42e50>] # valid

Once your selector code is valid you can add to your code and keep going!

headpin.auto's People

Contributors

aweiteka avatar els-pnw avatar gkhachikyan avatar

Stargazers

Tazim Kolhar avatar

Watchers

James Cloos avatar Tazim Kolhar avatar

Forkers

aweiteka jlaska

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.