Test methods and test case design
User requirements / original demand
Requirements analysis / specification (after review, will be unreasonable, do not place later remove the manual)
Test requirements (on the basis of the needs analysis, in order to test the team's work plan, the way the needs of priority work arrangements)
Mainly to solve the "what test" questions that indicate the object to be measured in what needs to be tested.
Function is the top priority, according to the working plan of the requirements of the test team
In the latter part of the exchange, the customer needs to continuously verify, you want to keep the document
For Test Engineer: Test test is generally divided into functional, non-functional testing
If there are no requirements document, a smoke test to do first, what is the function of the software in general, to understand, what is the key function of the number of function points, the reason needs
Test principle:
\ 1. All testing activities should be demand-driven and source
\ 2. And should continue to be tested as soon as possible
\ 3 fully tested (exhaustive testing) is not possible, the data are endless, there is always less than the test data
\ 4. There is no perfect software and perfect test
\ 5. Just programmer should avoid checking their own procedures to avoid arbitrariness (to avoid random testing)
\ 6. Twenty-eight law, the relative amount of time, cost and effort spent on important module, part
\ 7. Good enough do not adequately tested, do not do too much testing, testing to find a balance between the costs and the amount of testing
\ 8. Verification must be right and wrong
1, all testing activities should be traced back to user needs, test activities should be demand (user needs -> Requirements Specification) as the source and drive
2, should as soon as possible and continue to carry out software testing
3, fully tested (exhaustive test) is impossible, because the data itself is infinite, there is always unable to test data aspects. There is no perfect test and perfect software, undetected defects only, no software problem does not exist
4, shall be paid to colonization test: eight law (the relative majority of the time spent important parts)
5, only the programmer should avoid checking their own procedures, to avoid arbitrary test (ie, to avoid random testing)
6, the test is Good Enough, do not do adequate testing, do not do too much testing, find a balance between the cost of testing and amount of testing is the best choice
Develop and test content test is measured by the lowest standard (analyze specific issues if necessary)
7, taking into account a reasonable input data, the operation of the software input test data and unreasonable, the operation of software testing
8, after changes in procedures to do regression testing (no matter how many changes are to do regression testing)
Test completion criteria:
1) meet the functional requirements
2) all function point system under test should be covered (100% coverage) If a function is tested to the point, he said, the feature points are covered (but all to be delivered to the next stage of function, content, We must cover all the functions of points covering at least once)
3) test system does not allow the severity of one, two, three defects (fatal mistake, a serious mistake, a generic error)
4) All items must be complete configuration (each project must complete industrial chain)
Problems encountered during testing:
I do not know whether more comprehensive testing of all functions
Test coverage can not be measured
Repeat testing of the new version is difficult to implement
There are a lot of redundant test the impact of test efficiency
Before the software has not been tested, it needs to be designed to be very practical
Test Case
Test (Test Case) is a collection of test embodiments provided to the system being tested, the group set which comprises: a test environment elements, steps, test data, expected results and the like.
To solve any measure, how to measure, how to measure the problem
Software name, version, modules, test procedures, the order data, expected results (according to requirements, design, to predict possible outcomes)
// test can generally be divided into: a test case scenario (referred to as "test") and test case base (or referred to as a "work with the test")
Definition: set (the test environment, test procedures, data, code, expected results)
Solve the "what measure, how to measure, how to measure"
Before the test is designed to test the implementation, documentation preparation / reporting, it will not necessarily find defects
Defect report is after the completion of test execution, the report found problems, defects
effect:
1, the effective implementation of the test in accordance with (a document rather than verbal or subjective)
2, retroactive effective basis test (can do in return, to see when the defect analysis)
3, valid test data to measure the workload
4, testers measure the workload and quality of work in accordance with
5, according to the strength evaluation test coverage (demand content / function related to the point being tested, say that it is covered, demand / 100% coverage function points)
6, and the verification requirements of an important means to find defects
7, a new version or other reference items and cumulative test experience
When did you start the test case
Designers will be designed according to the needs, as long as the requirements and design documents in place, you can begin to write test cases
Testers time period longer than the period of time developers, testers early in the requirements phase to enter the testing phase
1, if the requirements, design, missing or incomplete, written after the software is completed cases
2, requirements, design complete
Familiar demand, then the design, or prior to encoding process implemented Design Example
3, after the software code, requirements, design changes, test cases need to change
4, needs to adjust execution during or after the execution embodiments, modifications
How to perform an operation action steps for the software?
Procedure what kind of input data, what about, what range of data to create a
Create data in a reasonable manner
Black box testing and functionality testing, compatibility testing, automated testing is equal
Design black box embodiment :( black box testing method: data-driven functional test, the internal structure is not of interest)
1, equivalence classes
Double-digit adding counter
Demand: the two-digit range (-99 to 99), two of the summed number
Package does not include two-digit decimal?
Measure the cost, time, assess the workload test
Addends 1: [- 99,99]
Addends 2: [- 99,99]
Workload: 199 * 199 = 39601
What data stay? Why leave these data? Why cut off the other data?
Equivalence class (exhaustive testing can not solve the problem of / the number of test control greatly within an acceptable range in cost / test of control)
Tested according to the user needs and characteristics and the characteristics of the data itself, the data is divided into a limited number of types, each type of the extracted data having a representative
How to use existing time cost, to what extent will divide data
Effective equivalence class
Invalid equivalence class
Equivalence Class 1: [- 99,99]
Equivalence class 2: <-99 -99 simultaneously because it can not find a number greater than less than 99, therefore, invalid equivalence class division
3 equivalence classes:> 99 for the two
Equivalence class division method
1, in a continuous data range, at least three equivalence classes may be divided, wherein an effective equivalence classes [0,100], two invalid equivalence class (<0) (> 100)
Regular data, for example odd, even, an equivalent method may be divided
Workshop:
Red micro-channel (0,200]
Analysis of demand characteristics, the characteristics of the boundary value, the need to take equal
Equivalence Class 1 0 <x <= 200
Equivalence class 2 x <= 0
Equivalence Class 3 200> x
T0305 sample software
Requirements: a group of student number [1,40]
All subjects [0,100]
A group of student number
1 equivalence classes [1,40]
Equivalence Class 2 <1
Equivalence Class 3> 40
Equivalence Class 4> 200
Achievement
Equivalence class 1 [0,100]
Equivalence Class 2 <0
Equivalence Class 3> 100
2, the predetermined input conditions must enter certain data, divided into at least an effective equivalence class, an invalid equivalence class
3, only two possible input data, true, false / yes, no, etc., into one equivalence class valid, an invalid equivalence class
4, to determine a valid equivalence class (a plurality of conditions are satisfied), a plurality of equivalence classes is invalid (does not meet the length requirement is not met or not met, or the beginning of composition, three invalid equivalence class)
5, on the basis of the known equivalence classes, as the case may be subdivided
Equivalence class subdivision of material such as:
Non-value:
Chinese character
letter
Other characters
blank
6, provides a set of input data values, and for each input value processed separately, several divided active equivalence classes, an invalid equivalence class
Is recommended as far as possible in a drop-down box, reducing input options, you can increase the number of drop-down box control
Equivalence partitioning steps of:
1, on input data analysis (binding requirements analysis, analysis of the characteristics of the data itself), and then divided into equivalence classes
Data type (input type) considering the input data, range data (input length)
2, a number of equivalence classes
3, the data in each equivalence class to use at least one
9.25 Review
Equivalence partitioning method
1, continuous data range can be divided into an effective, two invalid
2, some irregular predetermined input data set of values, e.g. codes, can be divided into a valid, an invalid
3, the input condition is Boolean true / fales, yes / no, can be divided into a valid, an invalid
4, a plurality of unrelated conditions constitute data range, e.g. Java identifier naming rules can be divided into an effective, more invalid
5, on the basis of the known equivalence classes, subdivided
6, the input data is a predetermined set of values irregular, and were treated for each input value, for example, drop-down boxes, can be divided into several effective, an inactive (except drop-down box, the other is invalid )
Standard division of equivalence classes
Complete testing, avoiding redundancy;
Mutually exclusive subsets: to ensure that no redundancy, a plurality of the same type used in Example data does not appear;
The sum of all subsets of the total set of data (entire collection).
Equivalence class 1 x> 99
Equivalence class 2 x <-99
-99<=x<=99
Equivalence Class 3 -99 <= x <0
Equivalence class 4 x = 0 if the 3 and 4 include the value 0, then causes redundant
Equivalence Class 5 0 <x <= 99
Boundary value
-99<=x<=99
if(-99<=x&&x<=99)
{
... // correctly handle
}
if(x<-99||x>99)
{
... // Error Handling
}
Boundary value equivalence class is derived from the method, as long as the range of data, it must have a boundary value
Open interval: a continuous range of values, greater than the minimum, less than maximum, not including the two end points
1<x<10 (1,10)
Closed interval: a continuous range of values, a minimum value greater than or equal, less than equal to the maximum, both inclusive
1<=x<=10 [1,10]
Point: not separately closed interval area, points on the boundary, and a point 10 is
If the open interval, the point in the field outside the range
If the closed interval, the point in the field outside the range
Interior Point: Any point within the range, are the points 2,3,4 etc.
From the point: if the open interval, from the point is the point closest to the point, if the closed interval, from the outer range from the upper point is the point closest point in the range of
Open interval (1, 10), that is, from the point 2, and 9, adduction, because 1,10 is an invalid value, it should also be taken disappear
Closed interval [1,10], and 11 are from the point 0, putting
Boundary value: from the point and a point
(49,79):49,79,50,78
(49,79]:49,79,50,80
[49,79):49,79,48,78
Recalling the morning of knowledge:
Boundary value (equivalence class supplementary / exception)
Open interval: does not include the maximum and minimum data in the range (1,10)
Closed interval: data comprising the maximum and minimum range [1,10]
Point: points on the boundary, maximum, minimum, does not distinguish the closed interval
Interior Point: any point within the range of
From the point: to distinguish closed interval, the point nearest point
Open interval from the point is the point closest to the point, within the close range, the minimum value of +1 units, the maximum value of -1 units, because the point is an invalid value, it should take the RMS
Closed interval from the point is outside the range of the closest point on the point, putting the minimum value -1 units, the maximum value of +1 units, because the point is a valid value, it should take invalid value
Theory 4 + 1, the two points from the two points, one point within
6 + 1 theory
[10,100] boundary value, 9,10,100,101
(10,100) boundary value, 10,11,99,100
Regardless of opening and closing zone, six boundary values: 9,10,11,99,100,101
If known, opening and closing zone, will have redundancy, if the demand is not clear, or not high technology team may consider the 6 + 1 theory
review:
Role of equivalence classes: exhaustive testing can not solve the problem, a great cost control within an acceptable range
Equivalence partitioning (according to the characteristics of the demand characteristics of the data itself divided)
Effective equivalence class: meet the data needs
Invalid equivalence class: does not meet the data needs
Equivalence partitioning method:
1, continuous data range can be divided into an effective, two invalid
2, a predetermined set of input data values are irregular, and for each input value processed separately, for example, drop-down boxes, can be divided into a number of valid, an invalid (in addition to the drop-down box, are invalid)
Equivalence class disadvantages: the data value is not accurate, the accuracy of the inaccurate / data values are not the same
Boundary value: equivalence class is a supplement to address the shortcomings of inaccurate data
The advantages of boundary value: accuracy, boundary data to determine the value of the data to solve the data Minimax possible problems
int i;
If(i>=1 && i<=12)
{
System.out.print (i + "May is the month"); // correctly handle
}
If(i<1 ||1>12)
{
System.out.print (i + "is not the month"); // Error Handling
}
Equivalence classes, boundary values are design data for the black box test
4 + 1 theory
Open interval: data comprising a maximum and minimum range (1,12) 1 <x <12
1,2,12,13
Closed interval: does not include the maximum and minimum data in the range [1,12] 1 <= x <= 12
0,1,12,13
Point: the point on the boundary of the range of the two end points
From the point: the point closest to the point, in the open interval, from the point is on the point nearest point range;
In the closed section, the point is outside the range from the point nearest point.
char c;
for(c=0;c<70000;c++)
{
System.out.print(c);
}
The code can be compiled, run, the result is an infinite loop,
ping -l 5000 192.168.0.106 to 192.168.0.106 IP address of the transmission packet number of bytes 50000
ping -t 5000 192.168.0.106 number of bytes sent to the IP address of the uninterrupted 192.168.0.106 packet 32
ping -l 5000 192.168.0.106 -t uninterrupted number of bytes sent to the IP address 192.168.0.106 packet 50000
ping IP address, sends packets to the IP address, packet byte ranges [0,65500]
Port number, short integer, [0,65536]
Design and manufacturing data
Data combination: FIG cause, orthogonally arranged (strong limitations)
Master the principles, objectives, procedures
Cause and effect diagram :( quality control, also known as Ishikawa diagram / Fishbone Diagram / branches map)
Data (by) input
Program results (fruit)
First analysis of causality
Determine the causes and because of the relationship between cause and effect
Example use evaluation criteria:
100% coverage requirements, functions, controls,
2, execution efficiency, text description is not clear enough, not precise steps
Between disjoint equivalence classes
The data is equivalent equivalence class classification, an effective and invalid equivalence class equivalence class is divided out, and then combine them
Many applications a number of input items, the number of equivalence classes ones, more in combination, excessive labor costs
Causality FIG basic steps:
1, the input sort items in the program, (according to the characteristics of the input data items) into equivalence classes (because)
2, to derive the expected sort result (if) in the program
3, consider the relationship between the result of the combination of the results generated (FIG Ishikawa)
4, formed is determined driving method determination table, to optimize the determination table (simplified)
5, each column of the table, i.e., a test determines
Solve the problem:
Analysis of data between the different combination result, so that test design / analysis result of the combination between the different causes and due to the generation of test cases
The reason is true, the result must be true
And (and): Two reasons are true, the result was true
Or: There is a reason for the true, the result is true
Non-: The reason is false, the result is true
Exclusive constraints: can not both be true between the various reasons, but at the same time is false
In a complex application can be localized FIG causal
Causal diagram way to write test cases
1, the threshold is relatively high (requirements analysis requires a certain capacity)
2, require a higher proficiency
3, high cost (large-scale, high complexity)
Orthogonal
Orthogonal test objectives:
Saving time / test-saving design time, reduce labor time permutations
Control the number of test cases
It has a more balanced coverage
advantage:
Test time-saving design, reduce labor time permutations
Control the number of test cases
It has a more balanced coverage
Features: uniform dispersion, (the same probability) than the neat
Orthogonal must meet these two characteristics, there is a not satisfied, it is not orthogonal:
1, the number of different numbers in each column appears (level) is equal to
2, any two, lateral composition on which number, each number is equal to the number of occurrences of
Factors: the study of variable / test entries / (appearance, family, personal, capacity)
Level: the range of factors to be considered are value / entry of equivalence classes / control, the equivalence class (height, weight, color values, background, economy, character, Three Views, age, economic life)
Factor 1: Level 1, Level 2 ... each factor equal to the number of horizontal
Factor 1: Level 1, Level 2 ...
……
Ln(mk) Ln_k_m
Times the number of rows in the table, the combination to be tested / test case: n
The number of columns in a table, the number of control / factors: k
The number of values of each control number included / level: m
Orthogonal representation of: (factor level count) L number of rows
L9 (34) is represented by the number of cases 9, Number 4 factors, each factor including three levels
Orthogonal table type
1, in full compliance with orthogonal (the same level of each factor, and in accordance with the law orthogonal) is applied directly aligned orthogonal ready
2, partial compliance orthogonal (the same level of each factor, but no ready-factors or orthogonal horizontal), the appropriate changes in the level of factors or may move closer to the orthogonal table, if the reduction in the orthogonal based on the increased use of artificial appropriate cases
3, the non-orthogonal neatly arranged by the formula and calculate the reduction in the number of arrays, and then arranged manually in the final number of law arrangement
Orthogonal formula: N = (p1-1) q1 + (p2-1) q2 + ... + 1
Number of levels: p
q: has a number of factors for this number of levels
N: The last number of results obtained last
1: check value
a:a1 a2
b:b1 b2
c:c1 c2 c3
d:d1 d2 d3
e: e1 e2 e3 e4 e5 e6
N=(2-1)2+(3-1)2+(6-1)*1+1=12
State diagram
Data, the operation of the operation
Analysis using the steps of the state of FIG.
1) lists the input event system under test
2) to an idle state (state of the program just started) plus all possible inputs, which generate new state judge
3) for each new state produced by the second step were added all possible input
4) Each new state of the third step are applied to produce all possible input
5) for each new state produced by the fourth step were added all possible input
6) until no new state generator
In the idle state, alone
first round
1, idle -> ip1-> RMB has been entered
2, idle -> ip2-> selected countries
3, idle -> ip3-> country not selected, the RMB is not entered
4, idle -> ip4-> idle
5, free -> ip5-> program quits
second round
1, the RMB has been entered -> ip1-> RMB has been entered
6, RMB has been entered -> ip2-> countries have chosen, the amount of RMB has entered
7, RMB has been entered -> ip3-> country not selected, the RMB has been entered
4, the RMB has been entered -> ip4-> idle
5, the RMB has been entered -> ip5-> end of the program, quit
Third round
6, the state has chosen -> ip1-> countries have chosen, the amount of RMB has entered
2, the state has chosen -> ip2-> selected countries
8, the country has been selected -> ip3-> countries have chosen, the amount of RMB is not entered
4, the state has chosen -> ip4-> idle
5, the state has chosen -> ip5-> end of the program, quit
Fourth Round
7, the state is not selected, RMB is not entered -> ip1-> country not selected, the RMB has been entered
6, the state is not selected, RMB is not entered -> ip2-> countries have chosen, the amount of RMB is not entered
3, the state is not selected, RMB is not entered -> ip3-> country not selected, the RMB is not entered
4, the state is not selected, RMB is not entered -> ip4-> idle
5, the state is not selected, RMB is not entered -> ip5-> end of the program, quit
4, the state is not selected, RMB is not entered -> ip6-> idle
The fifth round
6, the state has been selected, RMB has been entered -> ip1-> countries have chosen, the amount of RMB has entered
6, the state has been selected, RMB has been entered -> ip2-> countries have chosen, the amount of RMB has entered
9, the state has been selected, RMB has been entered -> ip3-> show the amount
4, the state has been selected, RMB has been entered -> ip4-> idle
5, the state has been selected, RMB has been entered - ended> ip5-> program exit
Sixth round
7, the state is not selected, RMB has been entered -> ip1-> country not selected, the RMB has been entered
6, the state is not selected, RMB has been entered -> ip2-> countries have chosen, the amount of RMB has entered
7, the state is not selected, RMB has been entered -> ip3-> country not selected, the RMB has been entered
4, the state is not selected, RMB has been entered -> ip4-> idle
5, the state is not selected, RMB has been entered -> ip5-> end of the program, quit
7, the state is not selected, RMB has been entered -> ip6-> country not selected, the RMB has been entered
The seventh round
6, the state has been selected, RMB is not entered -> ip1-> countries have chosen, the amount of RMB has entered
8, the country has been selected, RMB is not entered -> ip2-> countries have chosen, the amount of RMB is not entered
8, the country has been selected, RMB is not entered -> ip3-> countries have chosen, the amount of RMB is not entered
4, the state has been selected, RMB is not entered -> ip4-> idle
5, the state has been selected, RMB is not entered -> ip5-> end of the program, quit
7, the country has been selected, RMB is not entered -> ip6-> countries have chosen, the amount of RMB is not entered
Test points: gives an error message, click OK to complete the operation can continue right
Each state visit at least once
Multiple users are used, common module, to the state of multiple coverage
advantage
Which can be clearly seen that the state is not covered
Clearly the state of covering the intensity calculated
1, clear thinking, ask us well in advance of design ideas, needs analysis
2, an overview of test cases, test point should be clear and accurate
3, the test procedure is simple, that is, other people see your test cases, you can clearly see what to do first, what to do the second step
4, a clear test step, particularly, i.e. no ambiguity
5, i.e., non-redundant test cases do not repeat, with each test point of either the same embodiment
6,100% coverage is in the design of use cases, user requirements, functional, controls should be involved
7, reusability, i.e. test can be used repeatedly, high enforceability
100% coverage
2, to determine whether the expected results, the only
3, enforceability, description language is clear, if rigorous steps
4, the intermediate inspection, background data
Saved correctly, that data can be complete and accurate to save the background,
redundancy:
Equivalent classes exist in the design of the intersection set (when you divide equivalence class, there is an intersection)
To verify the reproducibility or not business requirements, step of a plurality of data exactly as in Example
A plurality of different types of test cases can not be tested and aspects of requirements, design or program or data
Consider equivalence classes, methods enough
1, 100% dot coverage requirements
2, the measured point function, the control 100% coverage
3, must have the right data, the right steps and pits can cause data errors, step
4, the data range covers a range of data must be considered: a boundary value, equivalence class
5, all values must cover boundary
6, equivalence class must contain valid and invalid equivalence class
7, must cover all equivalence classes (the number of equivalence classes exceed the test result in excessive cost, effective equivalence class priority, then the data frequency of use, the level of probability prioritize High priority cover, taking into account the automated test)
8, the core function points must be covered several times ()
Number 9, is greater than the number of test cases to function points