Joke Collection Website - Blessing messages - Detailed tutorial on the use of test case design tool PICT

Detailed tutorial on the use of test case design tool PICT

In testing work, we often encounter such a scenario: a software function has multiple input items, and each input item has multiple options; An interface has multiple parameters and each parameter has multiple values. This situation is very common at ordinary times. If combined according to the arrangement, the number of test cases obtained is very large.

It is easy to understand by giving an intuitive example. There is an interface function with three parameters, each of which can take four values. To verify all the parameters passed in, 4*4*4=64 cases need to be tested. If there were more parameters and values, it would be a disaster.

Is there a better way to do less testing and meet the test coverage? The answer is yes, which is the "factor combination test covering pairwise" that we are going to talk about today. Let's briefly introduce what Pairwise is.

Pairwise was first proposed by L.L. Thurston E (May 29th1887–September 30th 1955) in 1927. He is an American psychostatistician, and Pairwise is the product of optimizing the traditional orthogonal analysis method based on mathematical statistics.

Pairwise is based on the following two assumptions: each dimension is orthogonal, that is, each dimension does not intersect with each other; According to mathematical statistics, 73% of defects (35% for single factor and 38% for double factor) are caused by single factor or interaction of two factors, and 19% of defects are caused by interaction of three factors. Therefore, the use case set is the most cost-effective based on pairwise interactions covering all two factors.

Software testing is divided into black-box testing and white-box testing. Pairwise algorithm is an effective testing method for black-box testing in software testing.

This concept is usually vague. Here is a simple example. After reading it, you will understand how pairwise algorithm chooses test cases.

Pairwise algorithm process: starting from the last line of the table, if the paired combination value of this line can be found in the previous line or this table, then this line can be deleted from the use case set.

For example, if TC8 contains paired combination values of (X2-Y2, X2-Z2, Y2-Z2), X2-Y2 exists in TC7, X2-Z2 exists in TC6, and Y2-Z2 exists in TC4, then delete this row;

TC7 contains paired combination values of (X2-Y2, X2-Z 1, Y2-Z 1), and X2-Y2 cannot be found in this table, so it is reserved. According to this method, the final test case set is shown in the upper right. Obviously, after the pairing process, the number of test cases is reduced by half.

So if you have to calculate by hand every time, it will not only waste time, but also make mistakes easily. Once there are many parameters, there is no way to do it manually. Is it possible to develop an automatic program to output the results automatically? That's a good idea, but we don't need to make wheels anymore. There is already a very useful tool on the market, that is, PICT tool.

Enter the installation directory and create a new txt file in the directory, such as text.txt

There is a login page with options of user name, password, verification code and whether to save the password, in which at most 1 user name, password and verification are empty. If there are 5*3*4*2-3= 1 17 use cases, enter all parameters related to the test cases in txt, as shown in the following figure 1:

The parameter contents of test.txt are as follows:

User name:? Mobile phone number, email address, nickname, non-empty character, empty.

Password:? Correct password, wrong password, empty.

Verification code: correct verification code, error verification code, timeout verification code, empty.

Save _ Password:? Yes, no.

Run the cmd command in the installation directory and enter picttest.txt The result is as follows:

It doesn't look very beautiful. You can use the command picttest. txt >; The test.xls command outputs the results to the text.xls document, and the results are as follows:

I know from the requirements that at most only 1 user name, password and verification code are empty. What should I do? At this time, you need to use the constraint of PICT.

PICT constraint:

Submodel constraint:?

{ Para 1,Para2,Para3 } @ 2? # Any paired parameter combination must contain semicolons.

ConstraINts (such as, in, AND, OR, NOT) must end with a semicolon:

[User Name] <; & gt "empty";

[age] < 120 ;

[User Name] <; & gt "empty" or [age] <120;

[Nickname] likes "Li *";

If [username] = "empty", it is not [password] = "empty";

If [cluster size] is {5 12,1024,2048}, then [compression] = "off";

If [username] = "empty", then? [Password] <; & gt "null" and [verification code] < > "empty";

Therefore, in order to satisfy that at most 1 user names, passwords and verification codes are empty, the parameter constraints in text.txt are modified as follows:

The output result is as follows. You can find that there is no user name, password and verification code, and only 1 is empty at most:

What should I do if I want to cover all the user name, password and verification code combination test items? You can add the following parameter constraints:

This is all the constraints. When editing the test.txt file, remember not to edit spaces, colons and commas in Chinese, otherwise you will keep reporting errors and get no correct results.

All the above combinations are pairwise combinations. What should I do if I want to change the combination order parameter value? At this time, you only need to add the parameter /o:3 when running the command, such as pict test.txt /o:3. Other command parameter options have the following meanings:

/ o :N? -Number of combinations, the default value is 2.

/ d :C? -Delimiter between values, the default is comma (,).

/ a :C? -Delimiter between aliases. The default is the pipe character (|).

/ n :C? -invalid or illegal value prefix, the default value is (~).

/e:file- defines the seed file, which can specify the combination method.

/ r [:N]? -random generation, n seeds

/ c? -Parameter values are completely case-sensitive.

/ s? -Display model statistics