tierra_qa

IMPORTANT Notes: tierra_qa will be no more maintained. Use cookiecutter-qa instead (https://github.com/tierratelematics/cookiecutter-qa)!

Index

tierra_qa

IMPORTANT Notes: tierra_qa will be no more maintained. Use cookiecutter-qa instead (https://github.com/tierratelematics/cookiecutter-qa)!

Advanced

Here you can see the technical documentation.

Fixture Diagrams

The following diagram shows the interactions between the pytest fixtures created in the tierra_qa package:

digraph {
   skin;
   page_mappings,
   request;
   request -> {skin};
}
tierra_qa.tests.conftest.pytestbdd_feature_base_dir()[source]

Feature files base directory.

tierra_qa.tests.conftest.skin(request)[source]

This fixture provides the skin associated with the application on which starts the test session.

tierra_qa.tests.conftest.default_pages()[source]

A mapping with the default page object class for each skin

It’s up to you override this fixture with your settings.

For example:

DEFAULT_PAGES = {
    'skin1': 'mypackage.pages.BasePage',
}
tierra_qa.tests.conftest.page_mappings()[source]

Returns the page mappings dictionary with all known page with:

  • paths
  • optional page object class (otherwise the default implementation will be used as fallback provided by default_page_class())

See tierra_qa.config for further details.

Returns:dictionary with all known pages
Return type:dict`
tierra_qa.tests.conftest.splinter_screenshot_dir()[source]

Feature files base directory.

tierra_qa.tests.conftest.splinter_driver_kwargs(splinter_webdriver)[source]

Webdriver kwargs.

Page mappings config

Here you can define all your page mappings with path and optionally a class_page if you want your specific page object implementation. By default the tierra_qa.pages.BasePage will be instanciated.

For example you could configure your own page object implementations:

PAGE_MAPPINGS = {
    'HomePage': {'path': '/'},
    'HelloPage': {'path': '/hello'},
    'AnotherPage': {'path': '/anotherpage', 'class_page': AnotherPage},
    'AnotherPage': {
        'path': '/myfleet/cnh/app/view/io_profile.html',
        'page_class': {'skin1': ListingPage,
                       'skin2': Listing2Page,
                       'fallback': ListingPage},
        'links': {'edit': 'DigitalInputEditPage'}},
}

This is only an example, you can also decide to add extra optional info such as links that tells you where the current page leads you to another page or whatever you want.

Base page implementation

This is where the base page implementation lives.

class tierra_qa.pages.base.BasePage(driver, base_url=None, timeout=10, **url_kwargs)[source]

This is the base page to be used in tierra_qa.

Once you clone tierra_qa for your own qa project, you should:

  • implement the login, is_loggedin and logout methods of this class
  • add your own page object classes depending on your business logics inheriting from this base class
login(username, password)[source]

This is the login method of the base page object.

It’s up to you implement this method once you cloned tierra_qa.

Returns:BasePage instance
Return type:object
is_loggedin()[source]

This is the is_loggedin method of the base page object.

It’s up to you implement this method once you cloned tierra_qa.

Returns:True if you are logged in or False
Return type:bool
username()[source]

This is the username method of the base page object.

It’s up to you implement this method once you cloned tierra_qa.

Returns:the username or None
Return type:string or None
logout()[source]

This is the logout method of the base page object.

It’s up to you implement this method once you cloned tierra_qa.

Returns:BasePage instance
Return type:object

BDD tests examples

Here you can see a BDD test example:

Feature: Login
  A user login try to login to the application

  @UI @login
  Scenario: Successful login
    Given I am logged in as Administrator
    Then I am logged in

where Administrator stands for the user id.

You have to provide the Administrator username and password providing them in the credentials_template.yml. For example:

skins:
  skin1:
    base_url: http://www.tierratelematics.com/
    credentials:
      Administrator:
        username: admin
        password: admin

Changelog

0.0.1dev (unreleased)

  • Initial release