Test case design method Six Meridians Divine Sword - The Third Sword: Slaying the Dragon by Heaven and Slaying the Dragon, Orthogonal Test Charge | JD Logistics Technology Team

17128450:

1 Introduction

The previous article talked about the cause-and-effect diagram and decision table methods. However, these two methods will generate very large and redundant test cases in scenarios with many variable values ​​and a large number of permutations and combinations. At this time, it is difficult for us to test all combination scenarios. To carry out full test case coverage, based on this shortcoming, the orthogonal test method came into being.

2 Concepts and principles

2.1 Definition

The orthogonal experiment method is an experimental method that studies multiple factors and levels. It uses orthogonal tables to design experiments, and replaces comprehensive experiments with a small number of experiments. The
idea is to replace comprehensive experiments with partial experiments, and through partial experiments Analyze the results to understand the overall test situation.
Comprehensive test: The effect and interaction of each factor can be analyzed, and the optimal level combination can also be selected. However, the comprehensive test contains a large number of horizontal combinations and requires a large workload, which may not be completed in some cases.

2.2 Orthogonal table

The core of using the orthogonal experiment method to design test cases lies in the selection of the orthogonal table. The orthogonal table is a set of regular design tables, generally expressed as:

Among them, L represents an orthogonal table, n represents the number of rows of the orthogonal table (i.e., the number of test cases), k represents the number of factors or the number of columns of the orthogonal table (i.e., the number of input conditions), and m represents each The number of levels of factors, and n=k*(m-1)+1

  • Factors represent the variables that need to be observed in an experiment
  • Levels represent the maximum number of values ​​(values ​​of variables) that any single factor can obtain within the test range.

Give a chestnut:

An orthogonal table must meet the following two characteristics. If one of them is not met, it is not an orthogonal table:

  • Different attribute values ​​appear an equal number of times in each column.
    This feature shows that each level of each factor has exactly the same probability of participating in the experiment as each level of other factors, thus ensuring that the interference of other factor levels is eliminated to the greatest extent in each level, and the experiment can be effectively compared. results and find optimal test conditions
  • In any attribute value pair composed of two horizontal columns, each attribute value pair appears equally often.
    This feature ensures that the test points are evenly dispersed in the complete combination of factors and levels, so they are highly representative.

These are also the two major advantages of orthogonal tables, namely "uniform dispersion and neat comparability". In layman's terms, each level of each factor touches each level of another factor once. This is orthogonality.

3 method steps

3.1 Overall process

1. Determine the factors (variables) and the number of levels of each factor (variable values);
2. Determine the n value based on the number of factors and the number of levels. Two situations are distinguished here:

Single level orthogonal table (the number of levels for each factor is the same)

Mixed level orthogonal table, that is, an orthogonal table in which the number of levels of each factor is not exactly the same

3. Select an appropriate orthogonal table;
4. Map the values ​​of variables to the table according to the orthogonal table, and the value combination of each factor in each row is used as a test case.

3.2 Select orthogonal table

1. Check the orthogonal table designed by Dr. Genichi Taguchi: Dr. Genichi Taguchi orthogonal table https://www.york.ac.uk/depts/maths/tables/orthogonal.htm
2. SAS standard technical support: SAS design Orthogonal table http://support.sas.com/techsup/technote/ts723_Designs.txt

When searching, you need to pay attention to different types of orthogonal tables, distinguishing the following two situations:

1. Single horizontal orthogonal table:

2. Mixed horizontal orthogonal table:

When there are two or more orthogonal tables that can be selected, the selection principle is: choose the orthogonal table with the least number of tests.

4 Give a chestnut

Scenario: Test the reporting function of the third-level damage exception type that supports 4 special scenarios. The third-level exception
type = damaged outer packaging, spoiled goods, damage/leakage of intact inner contents.
Special scenario = irregular packaging, illegal collection. Collection, package sealing is abnormal, vehicle sealing is abnormal.
Upload method = single report, batch upload

4.1 Traditional method: full coverage

  1. Analyzing the above test requirements, according to the specifications, there are:
    three-level exception types (damaged outer packaging, spoiled goods, damage/leakage of intact inner contents)
    special scenarios (irregular packaging, illegal collection, abnormal package sealing, vehicle sealing) Therefore , there are 3 measured elements (factors), and each factor has 3, 4, and 2 values ​​respectively
    .
  2. Full arrangement for all level values ​​of all factors, the number of test cases: 3 4 2 = 24, the specific use examples are as follows:

4.2 Orthogonal test method design use cases

1. Determine the n value based on the number of factors and levels:

2. Select an appropriate orthogonal table. According to the calculation, n=6 is obtained. After searching Dr. Genichi Taguchi’s orthogonal table, it is found that there is no orthogonal table for n=6. At this time, we need to determine the orthogonal table to be used according to the following principles:

  • Find an orthogonal table that simultaneously satisfies n>6 && m>=max(m1=3,m2=4,m3=2) && k>=k1+k2+k3=1+1+1=3;
  • When there are 2 or more orthogonal tables that can be selected, the orthogonal table with the least number of tests is selected. This time, L16b is selected.

3. Fill in the mapping table with the level values ​​of each factor, and convert each row into a test case. The number of test cases is 12. It can be seen that the number of test cases is reduced by 50% compared with the full coverage method.

4.3 PICT generates orthogonal test test cases

Although using the orthogonal test method can help us select suitable test cases and improve testing efficiency, the process of selecting orthogonal tables and outputting test cases takes a certain amount of time. So is there a faster method?

Of course! PICT is a small tool that only requires us to provide all factors and variable values, and it can help us automatically generate test cases for orthogonal experiments. Next, let us learn how to use PICT to generate test cases!

Before using PICT to directly generate test cases, you need to prepare the txt file to generate test cases. This txt file must be placed in the same folder as the installation directory, otherwise it will have no effect.

This time, a file named test_pict.txt was created. Enter all factors and variable values ​​in the file. Each line is a factor and its corresponding enumeration of all variable values. Use ":" between the factor name and the variable value enumeration. " connection, each variable value is connected with ",", all are English symbols, no spaces, such as:

  • Abnormal third-level type: damaged outer packaging, spoiled goods, damaged/leakage of intact inner contents
  • Special scenarios: irregular packaging, illegal collection, abnormal package sealing, abnormal vehicle sealing
  • Upload method: single report, batch upload

Note that the encoding format is ANSI, otherwise the code will be garbled (you can use Notepad++ to change the encoding format), as shown below:

 
Next, we will start preparing to generate test cases and open the DOS window;
First, switch the directory to the pict installation directory, this time C:\Users\chenyuting50\Downloads, use this command:

pict test_pict.txt can automatically generate test cases, as shown below:

Next, you need to execute: pict test_pict.txt > text_pict.xls command to save the test case to the text_pict.xls file. The file will still be stored in the installation directory. Open the file and the content is as follows. Each line of data is a test case. :

5 Summary

However, the orthogonal test method is not suitable for test case design with strong process requirements. In these scenarios, we need to use the functional diagram method or scenario method to design test cases. How should these methods be used?

Author: JD Logistics Chen Yuting

Source: JD Cloud Developer Community Ziyuanqishuo Tech Please indicate the source when reprinting

 

IntelliJ IDEA 2023.3 & JetBrains Family Bucket annual major version update new concept "defensive programming": make yourself a stable job GitHub.com runs more than 1,200 MySQL hosts, how to seamlessly upgrade to 8.0? Stephen Chow's Web3 team will launch an independent App next month. Will Firefox be eliminated? Visual Studio Code 1.85 released, floating window Yu Chengdong: Huawei will launch disruptive products next year and rewrite the history of the industry. The US CISA recommends abandoning C/C++ to eliminate memory security vulnerabilities. TIOBE December: C# is expected to become the programming language of the year. A paper written by Lei Jun 30 years ago : "Principle and Design of Computer Virus Determination Expert System"
{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/u/4090830/blog/10320664