Blackbox exporter tcp example
Black-Box testing is also called functional testing or data-driven testing
Blackbox exporter
-The test object as the invisible inside the black box, without considering the internal structure of the program and the process of the case, the tester only according to the requirements of the program functional specifications to determine the correctness of test cases and inferred test results.
Blackbox exporter modules
– a test from the corresponding relationship between input data and output data from the standpoint of using software or programs
Prometheus blackbox exporter
– Testing at the interface of the software
– By exporting the set of input conditions for all functional requirements of the execution program, functional coverage, requirements coverage
Blackbox exporter docker
Blackbox exporter tcp
1 ) Equivalence class partitioning method
(1) Consideration factors for dividing equivalence class input data output data
Valid equivalence class: For the program specification, is a reasonable, meaningful set of input data composition
Invalid equivalence class: For program specifications, is unreasonable, meaningless input data composition of the set
(2) Criteria for dividing equivalence classes
1 Complete testing, avoid redundancy
2) Dividing equivalence classes is important: the division of sets, divided into a set of disjoint subsets, and subsets of the whole set
3) and is the whole set: availability
4 subset Disjoint: guaranteed a form of no redundancy
5 Identify (select) a test case in the same class, in the same equivalence class, often processing the same, the same processing mapped to the same execution path.
(3) Design test Cases
After the equivalence class is established, the equivalence class table can be established, and all the equivalent class input conditions are listed: Valid equivalence class, invalid equivalence class, and then the test cases are designed according to the following three principles in the divided equivalence class:
1 Specify a unique number for each equivalence class;
2 Design a new test case so that it can overwrite the valid equivalence class as much as possible, and repeat this step until all valid equivalence classes are overwritten;
3 Design a new test case to overwrite only an invalid equivalent class that has not been overwritten, repeat this step until all invalid equivalence classes are overwritten.
(4) Equivalence class case analysis:
Sina mailbox name, its input requirements are as follows:
1.4~16 characters
2. Support English lowercase, numerals, underline
3. Do not support all digits or underscores
Analytical:
Table 1-2
Enter criteria |
Valid equivalence class |
Invalid equivalence class |
Number of user name characters |
4~16 (1) |
0 (2), 0< number <4 (3), >16 (4) |
User name composition |
English lowercase (5), number (6), Underline (7) |
Non-English lowercase, numerals, underscores (8) |
User Name Support format |
Not all digits (9), not all underscores (10) |
All digits (11), all underscores (12) |
Mailbox name valid input collection:
(1) (5) (6) (7) (9) (a) 32JING_QFDA
Invalid collection:
(2) The mailbox name is empty
(3) Jby
(4) Jby_2015_12_22
(8) Denethor
(11) # 1234567890
(12) __________
Final Test Case:
Table 1-3
Serial number |
Input and operation instructions |
Expected test results |
1 |
32jing_qfda |
Meet the requirements |
2 |
Message name is empty |
Number of user name characters Does not meet the requirements |
3 |
Jby |
4 |
Jby_2015_12_22 |
5 |
Denethor |
User name composition Does not meet the requirements |
6 |
@#%...... |
7 |
Fday |
8 |
1234567890 |
User Name Support format Does not meet the requirements |
9 |
__________ |
2) Boundary value Analysis
(1) In general, a large number of errors occur on the boundary of the input or output range, not within the input range
– Design test cases for a variety of boundary conditions to identify more errors
For example, to do a triangular calculation, enter the three side lengths of the triangle: A, B, and C. We should note that these three values should be satisfied:
a>0, b>0, c>0, A+b>c, A+c>b, and b+c>a can form triangles.
But if any of the six inequalities in the greater than the number ">" error written greater than the equal number "≥", it can not constitute a triangle.
The problem arises just around the easily overlooked border.
(2) Principle of boundary value analysis
1 if the input conditions specify the range of values, you should take the boundary value that has just reached this range, and the boundary value just beyond this range as the input data for the test.
For example, the range of input values is "1~9", you can choose 1, 9, 0.9, 9.1 as test input data.
2 If the input conditions specify the number of values, then use the maximum number, the smallest number, less than the minimum number of one, than the maximum number of Do Yi as a number of books data.
For example, an input file should include 1~255 records, and the test cases would be 1 and 255, and 0 and 256 should be taken.
3 According to the specifications of each output conditions, the use of principle 1)
For example: The function of a program is to calculate the discount amount, the minimum discount is 0 yuan, the maximum discount is 1000 yuan. Then design some test cases so that they just produce 0 yuan and 1000 yuan results.
4 If the specification of the program gives an input or output field that is an ordered set, the first and last elements of the collection should be selected as test cases.
5 Analyze the specification and find out other possible boundary conditions.
(3) Steps to write test cases:
1 The boundary value is determined according to the input (or output) of the object being measured.
2 Select the value equal to, just greater than, just less than the boundary as test data.
Note: The basic idea is to take values at the minimum (min), slightly above the minimum (min+), normal value (nom), slightly below the maximum (max-), and the maximum (max).
(4) Case study:
There is a function f (x,y,z), where the x∈[1900,2100],y∈[1,12],z∈[1,31]. Please write out the test cases that the function is designed by using the basic boundary value analysis method.
Solution:
For programs containing 3 variables, a boundary value analysis method is used to produce at least 4*3+1=13 use cases
Table 1-4
<2000,6,1> |
<2000,6,2> |
|
<2000,6,30> |
<2000,6,31> |
<2000,1,15> |
<2000,2,15> |
|
<2000,11,15> |
<2000,12,15> |
<1900,6,15> |
<1901,6,15> |
|
<2099,6,15> |
<2100,6,15> |
<2100,6,15> |
|
|
|
|
3) Causal Diagram
(1) Using graphic method to analyze the various combinations of input, and then design test case method, this method fully consider the input of the various combinations and the constraints of the input conditions between the relationship.
(2) Scope of application
A variety of combinations that are appropriate for checking program input conditions
The equivalence class method and boundary value method are analyzed to consider the input conditions, and the relationship between the input conditions is not considered.
(3)
① Identity: If C1 is 1, then E1 is also 1; otherwise E1 is 0.
②: If C1 is 1, then E1 is 0; otherwise E1 is 1.
③ or: If C1 or C2 is 1, then E1 is 1, otherwise E1 is 0, or "can have any input."
④ and: If C1 and C2 are both 1, then E1 is 1, otherwise E1 is 0, and "can also have any input."
(4) The basic steps of generating a test case by causality diagram:
(5) Case study
Take Chinese chess in the way of the horse as an example, specific description:
1. If the placement is outside the chessboard, do not move the pieces;
2, if the landing and starting point does not constitute the Japanese font, then do not move the pieces;
3, if the placement has its own side pieces, then do not move the pieces;
4. If there is a piece (Trip horse leg) in the adjacent intersection of the direction of the landing point, do not move the pawn;
5, if it does not belong to 1-4, and no pieces at the point of placement, then move the pieces;
6, if it does not belong to 1-4, and the placement of the other pieces (not veteran), then move the pieces and remove the other pieces;
7, if it does not belong to 1-4, and the landing place for the other veteran, then move the pieces, and tips to overcome each other, the game is over.
Analytical:
Reason: 1, the landing point in the chessboard outside, 2, does not constitute the Japanese word, 3, the landing point has since the square piece, 4, stumbles the horse leg, 5, the landing point has no piece, 6, the landing point for each other piece, 7, the landing point for each other veteran.
Results: 1, do not move 22, mobile 23, move their own pieces to eliminate each other pieces, 24, move and beat each other.