Create Test Automation Framework - Introduction

by shawn-barrett 18. March 2010 03:59

  1. Create tests
  2. Add test definitions to QC automatically.
  3. Schedule and execute tests in QC
  4. QTP is invoked and runs specified tests
  5. Test results are uploaded to QC

The above diagram outlines the high-level architecture for the test automation framework we will create. I have chosen to use QTP as the underlying test automation "engine". Why? Typically keyword / data driven QTP frameworks are pretty similar, but in many cases the front end, to create the tests, is excel. That in itself is not necessarily a bad thing, but test templates may not be intelligent. Standards in test creation may not exist or test steps require manual entry. Experienced users of such environments rely on copy and paste when creating new tests. Data to populate the test step parameters may not be data driven or difficult to maintain. Using XML as a test format gives us some nice advantages. We save more than half on disk space (I use compression and serialisation in this project). We can diff files in source control (This project will deal with source control later) and more. Converting from XML to XLS(X) is very easy and this can be done if you have an existing QTP test schema that you use. The front end is written in C# (.NET 3.5) and I use Visual Studio 2008.

We will make Quality Centre (QC) the prime candidate for scheduling test execution. This will give you an idea of how to use the QC API. I will also show how we can run tests directly from the test editor (1). This will detail QTP API usage.

We will make use of VBScript to create the QTP framework. This will contain a driver script that will retrieve tests created in the Test Editor when a run is triggered in QC. Each test will be parsed and for each row in the test a VBScript call will be made to execute a VBScript that may be interspersed with QTP functionality. For example,

Step 3, when executed, will cause the driver script in the QTP framework to call a VBScript method "flight_AddOrder" and it will pass the subsequent fields as parameters,

Flight_AddOrder("17-03-2010","31-03-2010","London","Denver")

Notice the drop downs in the test step. These are dynamically populated when you add the test step to the grid.

Notes:

This is the outline for this project. When complete, I will expand this to include other test automation "engines"; Rational Robot, Selenium2, API integration/ Unit tests. I am also interested in showing you how to bypass VBScript for keyword code creation. So we'll create a C# engine that will drive QTP (or any other test automation tool).

Stay tuned...

Create-Test-Automation-Framework - Part-1a

Tags:

automated software testing | Framework | QTP | quality centre | Test Automation Implementations

About the author

shawn barrett