-
Notifications
You must be signed in to change notification settings - Fork 192
Home
Welcome to the qxf2-page-object-model wiki! This document provides step by step guide on components of our automation framework and provides good usage examples which help you get setup with Qxf2 Automation Framework quickly. This framework is startup-friendly and suitable for early-stage products automation.
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, Saucelabs 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 (https://qxf2.com).
- Setup
- Repository Details
- GUI Automation Framework Quick Start Guide
- API Automation Quick Start Guide
- Appium Automation Quick Start Guide
- Integration with Testrail
- Integration with Cloud Services
- Integration with CI Tools
- Utilities
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:
-
For Chrome: https://sites.google.com/a/chromium.org/chromedriver/getting-started
-
For Firefox: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver #Note: Check firefox version & selenium version compatibility before downloading geckodriver.
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
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.