Testing 9292020 TestingJGOOAD 1 Testing objectives Testing is
Testing 9/29/2020 Testing-JG-OOAD 1
Testing objectives • Testing is a process of executing programs with the intent of finding an error • A good testing is one that has a high probability of finding an yet undiscovered error • A successful test 9/29/2020 Testing-JG-OOAD 2
Testing principles • All tests should be traceable to customer’s requirements • Tests should be planned long before testing • The pair to principle applies to software testing – 80 % of all errors belong to 20% of the code • Testing should begin from small and progress to large • Exhaustive testing is not possible • To be more effective, testing should be conducted by an independent third party 9/29/2020 Testing-JG-OOAD 3
Test case design • An engineered product can be changed in two ways A. Knowing the specified function that a product has been designed to performs, tests can be conducted that demonstrate each function is fully operational while searching for errors in each function B. Knowing the internal workings of the product , test can be conducted to ensure that all operations are performed. According to specification and all internal components have been adequately exercised. There are two test approaches for the following 1. Black Box Testing 2. White Box Testing 9/29/2020 Testing-JG-OOAD 4
WHITE BOX TESTING • White Box Testing is also called Glass Box Testing. • it deals with close examination of procedural detail • it uses the control structure of procedural design to derive test cases • by exercising specific sets of conditions and/or loops – Test logical paths • Examine the status of the program at various places – to see if the expected or asserted status correspond to the actual status 9/29/2020 Testing-JG-OOAD 5
WHITE BOX TESTING • Consider two nested loops that execute from 1 to 20 times each, depending on conditions specified at the input • Inside the interior loop 4 if else statements are required 14 – There approximately 10 possible options • Exhaustive testing is impossible for large systems • A limited number of important logical paths is selected & exercised • Important data structures are probed for validity 9/29/2020 Testing-JG-OOAD 6
WHITE BOX TESTING • Using white box Testing methods the software engineer can derive test cases that – Guarantee all independent paths within a module are executed at least once. – Exercise all logical decisions on their true and false side. – Execute all loops at their boundary and within their operational bounds. – Exercise internal data structure to ensure validity. 9/29/2020 Testing-JG-OOAD 7
BLACK BOX TESTING • Why do we require Black Box Testing? – Logic errors and incorrect assumptions are inversely proportional to the probability that a program path will be executed. – WE often believe that a logical path is not likely to be executed when in fact it may be executed on a regular basis. – Typographical errors are random. There are 2 methods 1. Basic Path Testing 2. Control Structure Testing 9/29/2020 Testing-JG-OOAD 8
Basic Path Testing • Flow Graphs Notation – Flow Graph Depicts logical control flow using notations and each structure construct has a corresponding flow graph symbol. • Cyclomatic Complexity – Is a software metric that provides a quantitative measure of the logical complexity of a program. – It defines the number of independent paths (upper bound). • Deriving Test Cases – Using the design or code as a foundation draw a corresponding flow graph. – Determining the cyclomatic complexity of the resultant flow graph – Determine a basis of linearly independent paths – Prepare test cases that will force execution of each path in the basis set • Graph Matrices – Tabular Representation of a flow graph. 9/29/2020 Testing-JG-OOAD 9
Flow graph notation Sequence 9/29/2020 if while Testing-JG-OOAD until case 10
Cyclomatic Complexity 1 2 3 6 7 4 8 5 9 10 11 9/29/2020 Testing-JG-OOAD 11
Cyclomatic Complexity 1 1 2 2, 3 3 6 7 9 4 8 6 5 R 2 7 R 3 8 10 R 1 9 11 10 EDGE 9/29/2020 4, 5 NODE Testing-JG-OOAD R 4 11 12
Cyclomatic Complexity • The number of regions of the flow graphs correspond to the cyclomatic complexity • Cyclomatic complexity V(G) defined as – V(G) = E - N +2 = 11 -9 + 2 =4 V(G)= P + 1 = 3+1 1 2, 3 6 R 2 7 R 3 8 9/29/2020 Testing-JG-OOAD R 1 9 10 Each nodes that contains a condition is c/d predicate node 4, 5 R 4 11 13
Graph matrix 1 2 3 1 4 5 1 -1 =0 1 2 3 1 4 1 5 1 1 2 -1 =1 3+1=4 1 1 a 1 3 e 5 4 g 9/29/2020 d c 2 3 4 5 A 2 b f 2 3 D 4 C 5 g Testing-JG-OOAD b f E 14
CONTROL STRUCTURE • Condition Testing – Is a test case design method that exercises the logical condition contained in a program module • Data Flow Testing – Selects test paths of a program according to the locations of definition and used of variables in the program • Loop Testing – Focused exclusively on the validity of loop constructs. • Simple Loops • Concatenated Loops • Nested Loops • Unstructured Loops 9/29/2020 Testing-JG-OOAD 15
Loop testing • Loop testing white box testing • Focuses exclusively on the validity of the loops • 4 different classes can be defined – SIMPLE – CONCATENATED – NESTED – UNSTRUCTURED • Simple loops – n is the max number of passes • Skip loop entirely • Only one pass through the loop • 2 passes thru the loop • M passes thru the loop where m < n thru the loop 9/29/2020 • N-1, n , n+1 passes Testing-JG-OOAD 16
Loop testing • Nested loops – Start at the innermost loop. set all the other values to minimum – Conduct simple tests for the innermost loop while holding the outer loops at their minimum value. Add other test for out-ofrange or excluded values – Work outward , conducting test for the next loop, but keeping all other outer loops at the minimum value & other nested values at typical values • Concatenated loops – 2 loops are not independent if the loop counter for loop 1 is used as the initial value for loop 2 – Use approach of • simple loops if the loops are independent of each other • Nested loops if the loops are dependent on each other • Unstructured loops – Redesign to represent structured loops wherever possible 9/29/2020 Testing-JG-OOAD 17
Black box testing • Equivalence partitioning – Divides the i/p domain into classes of data from which test cases can be derived – Tries to reduce total number of test cases that may be developed – Equivalence classes may be defined for the foll • Range • Specific value • Set • Boolean • Boundary value analysis – greater the number of errors occur at the i/p domain rather than at the center 9/29/2020 Testing-JG-OOAD 18
Black box testing • Comparison testing – In aircraft avionics & automobile testing reliability of s/w is critical – Redundant h/w & s/w is used to minimise possibility of error – Separate s/w teams design independent versions of an application using the same specification – In such situations, each version is provided with the same test data to ensure that all provide identical o/p – Then all versions are executed in parallel with real time comparisons to ensure consistency 9/29/2020 Testing-JG-OOAD 19
• Software testing strategies pressman 9/29/2020 Testing-JG-OOAD 20
approach • Planned in advance • Conducted systematically • Have the following general characteristics – Testing begins at the component level works outward to the integration of entire computer based system – Diff testing techniques are appropriate at different points in time – Testing is conducted by the developer of the s/w & independent test group – Testing & debugging are different activities , but must be accommodated in any testing strategies 9/29/2020 Testing-JG-OOAD 21
Verification & validation [V & V] • Verification – Refers to set of activities that ensure that the s/w correctly implements the correct function • Validation – Ensures that the s/w is traceable to the customer requirements – verification : Are we building the product right – Validation: Are we building the right product 9/29/2020 Testing-JG-OOAD 22
Verification & validation [V & V] • Include a wide range of SQA activities [s/w quality assurance] – Formal technical reviews – Performance monitoring • Proper application of methods & tools, effective formal technical reviews, & solid management & measurement all lead to quality that is confirmed during testing 9/29/2020 Testing-JG-OOAD 23
system testing Validation testing Integration testing Tested as whole Validation between requirement & s/w built Black box Unit testing code Design & construction Black box design requirements System engineering 9/29/2020 Testing-JG-OOAD Component White box 24
- Slides: 24