Combination of BPT and qtp

Source: Internet
Author: User

FunctionsAutomated TestingAll of them will encounter a difficult problem-Test Framework. This is also the key to directly affecting the success of automated functional testing. If the framework is good, the test can get twice the result with half the effort. Otherwise, it is hard to seeWorkWill cause the entire test to fail. At present, there are many discussions on the testing framework on the Internet, including the formed testing framework. There are many good ideas in it, which are worth learning. But today we will not discuss what we already have on the Internet, but a testing system and business component testing that HP has designed for us. He is an architecture composed of qtp and QC. It can easily implement the currently popular three-layer test architecture: script layer, business layer, and data layer separation, providing an efficient, stable, and easy test implementation for automated functional testing.

I. Overview

1.1 Bussiness ProcessTesting) Introduction

Business components are the basic unit for process testing. Different business components can be combined to test different business processes. For example, to log on to the fligt system as the most component, select the most flight component. This allows you to reuse components and improve development efficiency.

1.2 advantages of Bussiness Process Testing

1) relevant business personnel can combine business components in environments without scripts to implement business processes.

2) There is no requirement on the programming capability of business personnel. Business personnel only need to understand the business process of the system and do not need to care about the specific script implementation. This also achieves separation between the business layer and the script layer.

3) Once a component is developed, it can be used in different processes to achieve high reusability, thus speeding up business process testing.

4) clear division of roles, business personnel are responsible for process development and organization, and qtp engineers are responsible for Script Development and Maintenance and Development and Maintenance of corresponding function libraries.

5) the reuse of scripts improves the efficiency of automated development and virtually reduces the maintenance time and cost during the testing process.

1.3 simple process of Bussiness Process Testing

The entire process is divided into two lines: the first is the division of components by business testers and the combination of different components for different process tests; second, the qtp experts are responsible for the specific implementation of the component script and the successful debugging, and upload it to QC for business testers to call.

Note: The organization of test data is introduced later to implement a three-tier test architecture. In this process, QC requires support from the Bussiness Process testing component license, that is, it needs to be separately purchased from HP.

The following example uses the qtp program to demonstrate the development process of the entire process.

2.1 divide Components

This time, the system is divided into: Login; select a flight and insert; open the order; update the order; Delete the order; cancel. This division is only for demonstration purposes and does not need to be tested in practice.

2.2 organize the business test process

This is only for demonstration, so the process will not be covered by 100%, and 100% of the process will be covered in the actual test process. The test process is as follows:

Process 1: log on, select a flight, insert it, and log off.

Process 2: log on, select a flight, insert it, update the order, and log out.

Process 3: log on, select a flight, insert it, update the order, delete the order, and cancel the order.

Process 4: log on, open an order, update an order, delete an order, and log out.

Below we need to implement the component script based on the divided components.

2.3 create an application Region

Before developing a script, you must create an application area. The application area provides all the resources and settings required to create business components. Each business group is located in an application area and these resources and settings are integrated from these application areas. Create a region named ticket booking system process test ,.

Creation process: Select File-New-function library. After the files are saved, they are automatically uploaded to the default QC directory.

You can also load your own function libraries, object libraries, and recovery scenarios, so that later creation can share resources in the application area. It is also easy to maintain, which is also an advantage. For example, once the function library is changed, you can load the new function library here without modifying it in script. In short, this application area is very important, and all subsequent scripts are based on this area. The application path must be correctly loaded; otherwise, the script cannot be generated during recording.

2.4 create a script

Before creating a script, it is best to organize the directory tree in QC for easy storage and calling. Everyone and every company have their own methods about the script development process. The Source Code cannot be pasted one by one. Therefore, only the input and output parameters are listed here to facilitate subsequent parameterization and data organization. This time, the most common method is the object library to solve the problem of object recognition. The Script Development specifications and parameter names are also in my usual use.

Note: "-" indicates that no corresponding parameter exists.
The component script created in qtp has two modes: bussiness component and scripted component. Difference: bussiness component can only be seen in the keyword view, QC can also see the keyword view; scripted component can see the expert view, the script code in QC is not visible. Generally, the latter is used to edit the script and control the script structure.
Note: The parameters must be properly set and the parameters of the input items in the Code must be parameterized and associated with the parameters. Otherwise, the test data cannot be passed to the script, causing the script to fail to run. Parameters can be created in qtp or QC, with the same effect.
Save the script to QC after it is developed ,:

 

The script has been developed. It also achieves the separation of scripts from the business layer and data layer. Now, a single component script is used to implement a function in the business flow and does not involve specific test data in the script, this laid the foundation for the implementation of a three-tier structure. The next step is to organize the business processes to be tested and the required test data in QC.
Note that if you select the bussiness component type in the qtp creation script, you can see the keyword view in qtp on the "design steps" tab, related personnel can perform the same operations on qtp but cannot see the code. This is why the script component is created above.
2.5 Business Process Organization
The organization of business processes is mainly implemented in the "test plan" module. This is mainly done by business testers. After the directory structure is planned, drag and drop the required components according to the business process to be tested. This step is similar to dragging test cases in a test plan. The difference is that it combines business processes and can be automatically executed. Effect after Organization

Note that you must select the "business-process" test type to create a use case. Otherwise, the component script cannot be dragged. Drag the script in the test script tab, as shown in. For more information, see the QC user manual. In addition, you can group components and control the process in groups based on the actual system. For example, select the 2-4 component, and then select the icon next to the fork in the toolbar to divide the component into a group. In this way, you can better control the process.
So far, all business processes are implemented. You can select Run (Green Arrow) in QC for related debugging.
Here we implement the business layer in a three-tier structure. There is no relationship between the business process organization and the script. The related personnel do not need to care about how the script is implemented, as long as all the processes are covered.
The next step is to implement the data layer to implement a three-layer test architecture.
2.6 organization of test data
The organization of test data is also implemented in the "test plan" module. Select a process, right-click the component to design data on the "test script" tab, and select "iteration" in the pop-up window. The component iteration setting window is displayed,

You can set the number of components to be iterated and the parameter values of each iteration based on the test requirements. For example, the Order Information entered in each iteration of three iterations is different. You can also set the input parameters to select the output parameters of the previous component (tick the check box and follow the prompts), as shown in. The "open order" component in process 4. The orderno parameter uses the output parameters of the "Select flight and insert" component. Note that three iterations are set for "Select flight and insert" in this process. Therefore, "open order" must correspond to three iterations. Otherwise, an error is prompted.


 
When organizing data, you can set the data for each iteration in a single component. This is still troublesome because of the large number of Component Reuse times. The solution is to import data in batches after the data is organized externally. QC is a TXT text file by default. You can export existing parameters in the format and design your own data according to the format given by QC.
So far, the design of the data layer has been completed. The test data is also separated from the specific business process.
In fact, the separation of data from the business layer is not very thorough and cannot be designed based on your own ideas. Therefore, there is still much room for improvement and further research is needed.
After completing the preceding steps, the development process is almost complete. In the future, related maintenance is required. Of course, the test should be executed at the end.

2.7 perform the test
Test execution is performed in the test lab. This is similar to the QC execution case. It is also the organization directory. Drag the corresponding test process, which is not described here. See the test cases section in the user manual. Of course, you can run the test on the local machine or on a remote machine, but be sure to install the corresponding components and set the host. The execution result is as follows:

QC records the results of each execution, including the execution status and execution time of each component in the process. This is also the strength of QC. It will give a very user-friendly result to facilitate our subsequent analysis and give a quantitative indicator to the system. QC has done quite well. From the demand to the final Defect Analysis and Test Report, there will be a graphical interface for our reference, this greatly facilitates writing test reports and provides us with powerful and reliable data support.
Note: All of the above work is completed in the WINXP (SP3) + qtp9.5 + qc9.0 environment.
Iii. Summary
This article only gives a brief description of the service component test, which is far less powerful than qtp and QC. For qtp and QCOthersThe function is not mentioned in this Article. Other functions play a role in automated testing and some tools cannot be replaced.Learning, One of the reasons for use! The investigation file 51 A while ago is a good proof that HP (MercuryAll products are far ahead of other tools. Of course, many companies also have their own testing frameworks and testing tools. However, it is undeniable that qtp is indeed a good test tool, although it is very expensive.
Qtp and QC are open architectures, and HP (formerly mercury) provides us with many interfaces, we can use these interfaces to develop our own framework to implement a three-layer or higher framework structure. These interfaces and function descriptions can be found in the qtp help document.
Finally, we hope that the domestic testing will develop better and better, and the Chinese software will become better and better.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.