How to start using the Qxf2 framework with a new project

This post will help you in modifying the Qxf2’s open-sourced test automation framework to use with your new project. In this post, you will learn about the files and folders to edit and delete so you can use the framework to write tests for your web or mobile application.

If you want to read more before you start

Here is a quick refresher on the various framework components. The framework (based on the page object pattern) essentially consists of the following components:

  1. Driver Factory – returns appropriate drivers for the browser.
  2. Page Factory – returns page objects.
  3. Base Page – consists of wrappers around common selenium operation.
  4. Fixtures – since we run tests with pytest, there are useful fixtures added in the conftest file.
  5. Conf files- every page has its conf files.

If you want a more detailed introduction to our test automation framework, you can read our framework’s wiki.

Overview

The rest of this post will show you:
1. Setup
2. Cleanup (deletions)
3. Edits

1. Setup

We assume you have already gotten setup with our framework, run the sample tests it comes with, evaluated it and then decided to implement it in your project. If not, please:

a) fork and pull our test framework that uses Python
b) follow the setup instructions in the readme.md on GitHub
c) run one of the existing tests to ensure you are fully setup (pytest-k example_form)

2. Cleanup

Please follow these steps to clean up(delete examples and related files).

  • Delete all test files under the tests folder,  don’t delete init.py.

Then, delete files mentioned in the table below:

conf folder page_objects folder endpoints folder
  1. api_example_conf
  2. example_form_conf.py
  3. example_table_conf.py
  4. mobile_bitcoin_conf.py
  5. successive_form_ creation_conf.py
  1. bitcoin_main_page.py
  2. bitcoin_price_page.py
  3. contact_form_object.py
  4. contact_page.py
  5. footer_object.py
  6. form_object.py
  7. .py, header_object.py
  8. table_object.py
  9. tutorial_main_page.py
  10. tutorial_redirect_page.py
  11. hamburger_menu_object.py
  1. Cars_API_Endpoints.py
  2. Registration_API_ Endpoints.py
  3. User_API_Endpoints.py
  • After cleanup, the folder structure should look similar to the image below :

3. Edits

You will have to make a few edits to let the framework know about your web or mobile application. You will also have to remove a couple of lines of code that refer to the example that we ship with.

  1. conf/base_url_conf.py holds the reference to the entry point to the app. Hence mention the base URL of the web application under test.
  2. page_objects/PageFactory.py file holds references to the pages being used in your application. Remove the imports and if-else conditions related to our example. Import the new pages you have added to your project.
  3. conf/locators_conf.py file has locators that apply to our example. You can delete the locators and replace them with the locators used in your application.
  4. The Readme file explains how the framework can be used. We suggest you can edit the readme as per your usage for easy collaboration among your team members.

Now you can add new tests and implement the test cases using our framework. Tests can be run with pytest. Hope by following this blog, you are able to quickly start using our framework. Happy testing!


 

 

I started my career as a Dotnet Developer. I had the opportunity of writing automation scripts for unit testing in Testcomplete using C#. In a couple of years, I was given the opportunity to set up QA function for our in-house products and that’s when I became full-time Tester. I have an overall 12 years of experience. I have experience in Functional – Integration and Regression Testing, Database, Automation testing and exposure to Application Security and API testing. I have excellent experience in test processes, methodologies and delivery for products in Information security and Pharma domain. On the Personal side, I love playing with kids, watch Football, read novels by Indian Authors and cooking.