Advance the maintenanceability of automated test kits - 3

zhaozj2021-02-16  46

3. Use data drive system

In the discussion of successful works, we have two categories, which are data-driven design and frame-based design, respectively. They can be isolated together.

An example of a data driver: assuming a program for creating and printing a table. You have to handle such a few things:

Table title. You can set different fonts, sizes, styles (bold, bertlasts, lowercase, normal).

The title position (on the table, next to the table) and the direction (the letter display horizontal or vertical).

Title drawing (next to the title or next), graphics (large, medium, small). He can be a bitmap (PCX, BMP, TIFF) or vector maps (CGM, WMF).

Table border edge dense

Table ranks and size.

Each cell font, size, style. Each cell is in size, position, rotation.

Form prints the size, direction of the output paper.

<<< Place big picture >>>

title

Top frame

Row

Feature 1 Some Characteristics

Because they do the same paper on the same time, the parameters are related. If some lines are particularly large, there is no place to leave the graphic. If the font is too much, the program has possible memory overflow. For example, these parameter tests are set in combination, then there will be 10,000 combinations.

Assume that one hundred scripts test 100 combinations. If an element of the interface changes, for example, if the title font is moved from a dialog to another dialog, then you have to modify each script.

Title location, title font, title pattern, title graphics (cg-caption graphic), width

1. Top Times PCX 3PT

2. Right Arial Body 2PT

3. Left Courier bold 1PT

4. Bold Helevtica Bolds TIFF

Features 2 starts from a form of test matrix with only a few lines

We start working from the test matrix. The test case contains a combination of many parameter variables. In this matrix, each row is set, and each column specifies the parameter settings. For example, a column may specify a title position, column two title font, column three title style. There are other columns.

Create a spreadsheet to create your own matrix, such as Excel.

Execute these test cases, write test scripts to read a row of data from the read spreadsheet (test case). Execute the script set the parameters specified in the spreadsheet. If we continue to work in the second line in the feature 2 disciples. The first run script reads data (title position) from the first column, sets the dialog correctly and writes in the field, and then sets the title location, which can be seen in the test matrix. Once all parameters are set correctly, you can do the remaining settings, you can print this form and evaluate whether the output is correct.

The test program will perform a small script of each line.

In other words, your structure is:

Load test case matrix

For Each Row I (Row = Test Case)

For Each Column J (Column = Parameter)

Execute The Script for this parameter:

Correct operation dialog or menu

Set the value read from the test matrix (i, j) position

Returns the test results

If the software design changes, the title location will be moved to a different dialog, you only need to change the very little code, and process the title position in each MINI script. You need to change these rows once: as long as you change the test cases in the spreadsheet. Compare the script that modifies each test case, separating code and data are very effective. There are several other ways to establish data-driven methods. For example, Bret Pettichord (Lawst Conference participant) fills in a series of commands in the form. Each row lists a series of commands that need to be executed (one command in a cell) to be executed. If the user interface changes, you need to modify the command sequence slightly. At this time, the tester is more convenient to modify the test case by modifying the data in the spreadsheet. Other testers can use simple test case sequences or current states.

Another method drives the data with the previous document, assumes that the test document processor processes thousands of documents. Each document, the script driver document processor loads document, then perform some simple operations (such as printing)

A well-known design data-driven approach can easily let the non-function test plan to write test cases because they simply write the test case into the test matrix. Other test cases can be produced in this way, if you are doing very well, just create a set of forms that make a concise test tool to run.

4. Frame-based system

This framework provides a completely different way, although he often uses multiple data driver test strategies. Tom Arnold (Lawst members) discussed this method in his books and courses.

This framework separates the test application and test script by a series of functions in the shared library. Script developer personnel regards these functions as the underlying command in the development language of the test tool itself. They thus separated the software interface and test script.

For example, a framewriter may create a function - OpenFile (p). The function opens the file P. Drop the file menu, select Open Command, Copy the file name to the file field, select the OK button to close the dialog box, and then operate. Or the function is much more than this, if the error is handled. The function may check if the file P is opened or written to the log on the file to write the log, and write the result to the log. This function may also replace the Open File dialog box through a shortcut command. The program can be tested using the application programming interface (API) or Macro language, or the function can call simple commands and send file names and paths as parameters. The definition of this function is constantly changing. Script Developers use the function name OpenFile (x) to open the file x.

转载请注明原文地址:https://www.9cbs.com/read-23756.html

New Post(0)