Test environment usage issues and optimization countermeasures practice

1 Background and issues

G.J. Myers proposed in "Software Testing Skills": Testing is the process of running a program to find errors. A good test case is a test that is likely to find errors that have not been discovered so far. A successful test is one that reveals Testing for bugs that have not been discovered so far.
For novices, systematic methodologies are rarely used when designing daily test cases. Most of the time, test cases are written directly based on product requirements documents or their own subjective judgments, which often leads to serious problems such as missed tests. Therefore, it is crucial to use methodology to support the process of test case design and make it more rational and standardized. However, there are many types of test case design methods and different applicable scenarios. When writing test cases for specific requirements, it is difficult to choose the appropriate method for design.

2 Goals and significance

J.M. Juran, an authority figure in the field of quality management, defines quality as "the characteristics that determine product performance" and "satisfaction", and testing focuses on product satisfaction. The process of test case design is to transform product requirements into an operable step, which plays a vital role in the entire product life cycle. Standardized use case design based on methodology can help testers expand the scope of testing and improve testing. coverage, reducing the missed detection rate and improving product satisfaction.
This series of articles analyzes the classic test case design methods one by one, and goes deep into the actual needs of daily work, conducts practical exercises based on specific scenarios, and summarizes the applicable scenarios of each method to form a reusable system template. , help everyone quickly become familiar with commonly used test case design methods, improve testers' professionalism and work efficiency, thereby improving delivery quality.

3 Preliminary exploration

When it comes to test case design methods, the most likely ones that come to mind are equivalence classes and boundary value methods. So, first of all, we will introduce these two test case design methods.

3.1 Equivalence Class Division Method3.1.1 Concepts and Principles

1.Definition
  • Equivalence class: a subset of an input domain
  • Equivalence class division: effective equivalence class (reasonable and meaningful input set)
  • Invalid equivalence class (unreasonable or meaningless input set)
2. Basic idea
When designing test cases, consider both equivalence classes. Because the software must not only receive reasonable data, but also withstand unexpected tests, such testing can ensure that the software has higher reliability.

3.1.2 Method steps

  • According to needs, it can be roughly divided into two types: effective and ineffective.
  • Then refine the corresponding equivalence class (refining from the combination situation)
  • Create an equivalence class table
  • Generate test cases

3.1.3 Give a chestnut

Scenario: The input rules of an input box are a combination of 1 to 12 letters and numbers.
According to the equivalence class division method, the equivalence class table can be established as follows (split the input into length and symbol combinations), and then the use cases can be obtained

[td]

divide valid equivalence classes serial number Invalid equivalence class serial number
length [1,12] (1) 0 (2)
- - (12,+∞) (3)
symbol a (4) Numbers + other characters (5)
- - other characters (6)


3.2 Boundary value analysis method3.2.1 Concepts and principles

1.Definition
It is a supplementary method of equivalence class division. The boundary of equivalence class division is used as a use case design (in the boundary values ​​of valid and invalid equivalence classes, there will be duplicate values, and the choice can be made according to valid and invalid).
2. Basic idea
A large number of errors occur at the boundaries of the input or output range, rather than within the input and output range. Therefore, in order to ensure test quality, it is necessary to focus on testing the boundaries, and there are testing methods such as boundary values.
3. The relationship between equivalence classes and boundary values
  • Boundary value analysis is a supplement to the equivalence class division method. Boundary value analysis does not randomly select one from an equivalence class as a representative, but makes each boundary of this equivalence class serve as a test condition.
  • Boundary value data essentially belongs to the range of an equivalence class. It is sometimes redundant during testing (exactly equal to, just greater than or just less than the value of the boundary), but for better test quality, the boundary value must be separate For testing, appropriate and necessary redundancy is acceptable.
4. How to use
So how do we find the boundary value? Generally, we will pay attention to the following points:
  • Upper point:The endpoint value of the interval
  • Inner point:Any point between the upper points
  • Offpoint:If it is the offpoint ofopen interval, it isThe point immediately inside the upper point in the open interval; if it is the departure point of the closed interval, it is The point immediately outside the upper pointClosed interval
① Closed interval
② Half-open and half-closed interval
③ Open interval

3.2.2 Give a chestnut

Scenario: The input rules of an input box are a combination of 1 to 12 letters and numbers.
Specifically, an equivalence class table can be established as follows (split the input into length and symbol combinations)
According to the boundary value method, determine the upper point (1,12), interior point (2), and away point (0,13) according to the closed interval [1, 12], and establish the equivalence class and boundary value table as follows (split the input There are two types of growth degrees and symbol combinations), and use cases can be obtained.

[td]

divide valid equivalence classes Boundary value Invalid equivalence class Boundary value
length [1,12] 1,2,11,12 0 0
- - (12,+∞) 13
symbol a Numbers + other characters
- - other characters


3.3 ​​Test design - "equivalence class + boundary value"3.3.1 Give a chestnut

Scenario: Format verification of mobile phone numbers compatible with landline numbers
  • There are horizontal bars: XXX (3 or 4 digits)-XXXXXXXX (7 or 8 digits): 3+7 or 3+8 or 4+7 or 4+8
  • There are horizontal bars and extension numbers: XXX (3 or 4 digits)-XXXXXXXX (7 or 8 digits)-XXX (1-5 digits)
  • No horizontal bars: XXX (3 or 4 digits) XXXXXXXX (7 or 8 digits) 11-17 digits
  • The first digit to cancel must be "1", and the second digit to cancel must be "divided by 0, 1, 2" restrictions.

Design steps:
1. Equivalence class division: Take the first one as an example - there are horizontal bars: XXX (3 or 4 digits) - XXXXXXXX (7 or 8 digits)
According to the steps of the equivalence class division method, first split the first part and the second part to obtain the effective equivalence class [3, 4] and the invalid equivalence class of the first part (len>4 & 0<len<3) ; Obtain the valid equivalence class [7,8] and invalid equivalence class (len>8 & 0<len<7) of the second part. By analogy, all valid and invalid equivalence classes are obtained.
2. Boundary value analysis: locate the upper point, inner point, and away point according to the opening and closing of the interval.
For example: the upper points of the valid equivalence class [3, 4] are 3 and 4, the outlier points of the invalid equivalence class (len>4 & 0<len<3) are 5 and 2, and there are no interior points.
3. Data processing: List all situations according to steps 1 and 2 and the combination of data.
4. Organize the final test case: Based on the data obtained in step 3, design the test data and corresponding expected results as required to obtain the final test case.

4 SummaryMethod Equivalence class division method Boundary value analysis method
Core "classification" and representative values ​​boundary value and adjacent values ​​on both sides of the boundary
Advantages By classifying input data and output data and selecting representative values ​​​​in the classification, the number of test cases is greatly reduced while ensuring test coverage, making the testing work simple and efficient. A large number of program errors occur at the boundaries of inputs. Test cases that take boundary values ​​into account can more efficiently find errors and defects in the program
Disadvantages: The relationship between inputs is less considered, which may cause Some logic errors. Other use case design methods are also needed to supplement testing. Testing can only be used as a supplement to other design methods; this method sounds simple on the surface, but some boundary values ​​​​are very subtle and not easy to determine; it is only suitable for multiple variables that are independent of each other. They all represent actual physical quantities, and the dependence between variables cannot be taken into account.
Where the applicable scenario has data input (edit box), the equivalence class division method can be used. For example: when users log in, register, create, or query data and there are value boundaries or length boundaries, the boundary value method is often used together with the equivalence class division method to form a relatively complete test plan.

Equivalence class division and boundary value analysis methods only consider a single input condition, and are difficult to play an effective role in scenarios where there are various combinations of input conditions and mutual constraints between input conditions. In this case, causal diagrams and judgments are needed. The table method is here to help us design test cases, let us take a look~

Thank you to everyone who reads my article carefully. There is always a courtesy. Although it is not a very valuable thing, if you can use it, you can take it directly:

These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends, and this warehouse also accompanies Thousands of test engineers have gone through the most difficult journey, and I hope it can help you!Friends in need can click on the small card below to receive it 

 

Guess you like

Origin blog.csdn.net/kk_lzvvkpj/article/details/134926612