Skip to content
Indira Nellutla edited this page Mar 5, 2018 · 63 revisions

Welcome! This document provides step by step guide on components of our Qxf2 Automation Framework and provides good usage examples which help you get setup with Qxf2 Automation quickly. This framework is startup-friendly and suitable for early-stage products automation.

Qxf2 Automation Framework Overview

A Pythonic GUI and API test automation framework to write Selenium, Appium and API tests in Python using the Page Object pattern. It comes with many useful third-party integrations like CircleCI, Jenkins, Slack, Email, TestRail, pytest, BrowserStack, Sauce Labs etc., and helps you get started with QA automation of mobile (Android and iOS) and web applications quickly. Since it is implemented in one of the popular model known as Page Object Model, it allows writing robust automation scripts that are maintainable. This repository is developed and maintained by Qxf2 Services.

Table of Contents

Setup

a) Install Python 2.x

b) Add Python 2.x to your PATH environment variable

c) If you do not have it already, get pip (NOTE: Most recent Python distributions come with pip)

d) pip install -r requirements.txt to install dependencies

e) Get set up with your browser driver. If you don't know how to, please try:

f) [ADVANCED and OPTIONAL] Update 'conf/remote_credentials.py' if you want to run on BrowserStack/Sauce Labs

g) [ADVANCED and OPTIONAL] In case you have TestRail Integration update the 'conf/testrail.conf' with proper case ids. Also update the 'conf/testrail.env' with url,user,password.

h) [ADVANCED and OPTIONAL] Refer 'utils/post_test_reports_to_slack.py'and add slack incoming webhook url if you want to post the test reports on Slack channel.

i) [ADVANCED and OPTIONAL] Refer 'utils/ssh_util.py'and update the conf/ssh_conf.py with the host, port, username, password, commands if you want to connect and execute commands on remote server.

If your setup goes well, you should be able to run a simple test with this command:

  • Chrome: python tests/test_example_form.py -B Chrome

  • Firefox: python tests/test_example_form.py -B Firefox

Repository details

Project Root
   
   |_ conf: For all configurations and credential files
   
   |_ app: Contains mobile APK file

   |_ endpoints: Contains our Base Mechanize, different End Points, API Player, API Interface

   |_ log: Log files for all tests

   |_ page_objects: Contains our Base Page, different Page Objects, DriverFactory, PageFactory

   |_ screenshots: For screenshots

   |_ tests: Put your tests here

   |_ utils: All utility modules (email_util,TestRail, ssh_util, BrowserStack, Base Logger, post_test_reports_to_slack) are kept in this folder
   
   |_ conftest.py: Configuration file to add different fixtures used in py.test

a) conf - All the configurations and credential files are maintained in the .conf file. Each parameter in the conf file is stored as key/value pair. In our framework, we are using conf files for fetching the data and locator values. For example, the details like name, email, phone, and gender are stored in a conf file as shown below.

example_conf.py

name = "name"
email = "email"
phone_no = phone_no
gender = "gender"

The same details can be fetched from the example_conf.py file using the below code in the test script.

import conf.example_conf as conf

name = conf.name
email = conf.email
phone = conf.phone_no
gender = conf.gender

b) log - While running a test, we may need some information to be logged in the console and a log file. Information could be any detail depending on our project requirement. This information helps us to understand the test steps and any failure/success of the test execution. We have a class called Base_Logging() which wraps around Python's logging module and takes care of logging functionality.

c) page_objects - This folder consists of Page Objects that represent a webpage. The Page Object Model makes it easy and quick to modify tests to suit corresponding changes in the GUI. We created a Page object for each page. The test script will interact with the methods defined in these Page objects. For more details about Page Object model refer to our blogs on Page Object Model and Page Object Tutorial

d) tests - This folder consists of sample test scripts to validate the workflow in the web application. The test is very easy to read and need not be modified in case of any underlying changes to individual pages. The sample tests in the repository would fill the example form in the selenium-tutorial-main page and get redirected to the selenium-tutorial-redirect page when the form is submitted. Any change to the page elements can be handled by updating the locators_conf.py without changing the test script.