0% found this document useful (0 votes)
207 views62 pages

Oose Unit-4

ooos6

Uploaded by

Ganesh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
207 views62 pages

Oose Unit-4

ooos6

Uploaded by

Ganesh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 62
Software Testing and Maintenance bus «ag - Unit testing - Black box testing - White by , 10x testing - I i i japession resting - Debugging ~ Program analysis - ‘Symbolic Teale ee hee ; mn fel Checking- Contents .. May-07,16, .. Dec,-04,05,08,10...... 44 Introduction to Testing ... 42 Intemal and External Views of Testing 43 Black Box Testing .. May-07,12,15,16,17,19,22, Dec.-03,04,11,13,15,16,20,..Marks 16 .. May-04,07,08,17,18,19, - Dec.-11,13,14,16,97, .o.-- Marks 10 May-05, 06, 22, . Marks 16 __ Dec.-06,08,15, May-03,09,.. Marks 16 __ Dec.-06,08,15,19, May-03,04,05,09, - | May-13,14,15,17,18, on Marks 16 May-03,04,05, Dec.-14, .. May-05,16, -_ Dec.-10,14, May-15,18, 44 White Box Testing 45. Testing Strategies 48 Unit Testing 47 Integration Testing ... Marks 16 48 System Testing 49 Validation Testing i puaaing Techniques .. hs nt Analysis i ene Execution 446 7 ! Checking Wo Marks Questions with Answers Object Oriented Software Engineering 4-2 Software Testing ang Maintonanes E&I introduction to Testing TATE TRTETAT NT, Definition : Software testing is a critical element of software quality assuran ce ang represents the ultimate review of specification, design and coding. The purpose of software testing is to ensure whether the software functions appear be working according to specifications and performance requirements. to Testing Objectives According to Glen Myers the testing objectives are, 1. Testing is a process of executing a program with the intend of finding an error, 2. A good test case is one that has high probability of finding an undiscovered error, 3. A successful test is one that uncovers an as-yet undiscovered error. The major testing objective is to design tests that systematically uncover types of errors with minimum time and effort. Testing Principles Every software engineer must apply following testing principles while performing the software testing. 1. All tests should be traceable to customer requirements. 2. Tests should be planned long before testing begins. 3. The Pareto principle can be applied to software testing - 80 % of all errors uncovered during testing will likely be traceable to 20 % of all program modules. 4. Testing should begin “in the small” and progress toward testing “in the large”. 5. Exhaustive testing is not possible. 6. To be most effective, testing should be conducted by an independent third party. Why Testing is Important ? * Generally, testing is a process that requires more efforts than any other software engineering activity. : * Testing is a set of activities that can be systematically. “© Ifit is conducted haphazardly, errors may get introduced, Planned in advance and conducted then only time will be wasted and more even wor’? * This may lead to have many undetected errors in the system being developed Hence performing testing by adopting systematic strategies is very much essenti! in during development of software, — ein ob aed Software Testing and Maintenance esr 414] Why does software testing need extensive planning ? Explain, goat: Following are the issues that exp 1. Testing is a Process of executing the Program with the intent of finding errors. Although it is an expensive activity, yet it is essential to perform testing rigorously especially in systems where human safety is involved. Testing requires the developers difficult for developers to Point out errors from their own design or code. Hence many organizations have mad. le distinction between development and testing phase by making different people responsible for each phase. The testing is performed on program's res means, we should test for all valid and testing each and every input can not be te: invalid inputs must be tested, lain why the testing need extensive planning. r to find errors from their software. But it is very 2 sponse to every possible input. That invalid inputs. Although practically sted, the important cases of valid and = Another aspect of testing is for execution of all possible paths of program. A Program path can be traced through the code from the start of the program to Program termination. Although it is just difficult to test each and every path of the program, it is expected to test those areas where probability of getting a fault is maximum. Thus organizations should develop strategies and techniques which requires extensive planning Distinguish among Error/Fault/Failure. AU : CSE, Dec.-04, Marks 6 OR Distinguish between software fault and failure. lution : Error : It is a state that can lead to a 5 system user, Policies for choosing effective testing AU : CSE, Dec.-08, Marks 2 yystem behaviour that is unexpected by the Fault :Itis a characteristic of a software system that can lead to system error, Failure : It is an event that occurs at some point in time when the system does not deliver a service as per user's expectations. istinguish between defects and errors. a rete that can lead to a system behaviour that is unexpected by the system © software team performs the formal technical reviews to test the software developed. "S teview errors are identified and corrected. Solution ; Error Any errors that remain uncovered and are found in later tasks are called defects. Error “val is software development activity and defect removal is a software quality “SSurance activity, :® - an up-thrust for knowledge TECHNICAL PUBLICATIONS® - an up- Oriented Software Engineering ; , TITER] When do you stop testing ? Justify your answer with two illustrations, . It is said that testi Solution : Testing is a complex activity in the software systems. mr . 8 is ay idless and complete testing not possible for almost all the projects. But there an endless process ani lop testing. some common factors that are required to decode when to stop iB: Software Testing and Main 1, When the testing cost is increasing and if it is more than the project cost then itis enough to test. cil 2. If the project deadline and testing deadline is already crossed. 3. After completion of critical or key test cases one can stop testing. 7 If the project is meeting functional coverage, code coverage or satisfying the client requirements at some point. , When high priority bugs are resolved and defect rates fall below certain specified level. 6. When project progresses through alpha and beta testing, For example : Case 1: In the development of Windows operating system the Internet Explorer is a famous web browser that we use. There are many security patches that need to be applied. Some Patches are already introduced with newer versions of operating systems. But still this Product specially shows how testing is an endless Process. Case 2: For sorting a list of elements typical test cases can be - Test case name “Expected result Testing unsorted list, 12,3 Testing when equal elements are Present. 2.23 Testi is 4 eee hat Print message “List is empty”. Testing with negative numbers, ficient it ae Sth oe function. Thus unlike case 1 we can stop testing here op EEEIIRE What are ine ‘Gharacterstcs of good taste» TAU Dec. ae] Solution : Following are the characteristics of good tester 1. The tester must be able to understand the so ; tion €0 find out high probability errose ftware. He should be in a posi Seo Glia os To eee ae se vented Software Engineering 4:6 - Software Testing and Maintenance 9, The tester must not conduct two different tests for the same purpose. 3, The tester must be able to write simple test cases, 4, The tester should conduct the tests which should have highest likelihood of uncovering errors. BBinternal and External Views of Testing ‘There are two views of the testing. The internal view and external view. The internal view is also known as white box testing and the external view is also known as black box testing. 4. Black box testing The black box testing is used to demonstrate that the software functions are operational. As the name suggests in black box testing it is tested whether the input is acepted properly and output is correctly produced. The major focus of black box testing is on functions, operations, external interfaces, extemal data and information. 2.White box testing In white box testing the procedural details are closely examined. In this testing the internals of software are tested to make sure that they operate according to specifications and designs. Thus major focus of white box testing is on internal structures, logic paths, control flows, data flows, internal data structures, conditions, loops, etc. EX] Black Box Testing * The black box testing is also called as behavioural testing. * Black box testing methods focus on the functional requirements of the software, Test sets are derived that fully exercise all functional requirements. * The black box testing is not an alternative to white box testing and it uncovers different class of errors than white box testing. Why 4 t0 Perform black box testing 7 Black box testing uncovers following types of errors. 2. Interface errors 4, Performance errors 1. Incorrect or missing functions 3. Errors in data structures 5. Initialization or termination errors Object Oriented Software Engineering 4-6 Software Testing and Maintenanog Equivalence Partitioning Input set * It is a black box technique that divides the input domain into classes of data. From this data test cases can be derived. * An ideal test case uncovers a class of errors that might require many arbitrary test cases to be executed before a general error is observed. * In equivalence partitioning the equivalence classes are evaluated for given input condition. Equivalence class represents a set of valid or invalid states for input conditions. © Equivalence class guidelines can be as given below: Valid input Invalid input = If input condition specifies a range, one valid and two invalid equivalence classes are defined. Output generated = If an input condition Tequires a specific Fig. 4.3.1 value, one valid and two invalid equivalence classes are defined. «If an input condition specifies a mem ber of a set, one valid and one invalid equivalence class is defined, = Ifan input condition is Boolean; on is defined. For example : e valid and one invalid equivalence class Area code : Input condition, Boolean - The area ¢ Input condition, range - Value defined between Password : Input condition, Boolean - A passw ‘ode may or May not be present. 200 and 700, ord may or may not be present. Input condition, value - Seven character string. Command : Input condition, set - Containing commands noted before. Describe black box testing. Design the black-box test Suit for the following program. The program computes the intersection point of two Straight lines and displays the result. It reads two integer pairs ( My C) and (m,, c,) defining the two straight lines of the formy! =mx +c. sot Oriented Software Engineering 4-7 Software Testing and Maintenance station: Black box testing : Refer section 4.3, ‘The equivalence classes for given program are as follows : 1) Parallel lines if m, = m,, c, # c 2yIntersecting lines if m, # m, 3) Coincident lines if m1 = m,, c,=¢, The representative values can be selected from each equivalence class. Thus the test suit obtained can be 6,5) 6,7) 7,10) (8, 12) (45, 15) (15, 15) Boundary Value Analysis (BVA) * Boundary value analysis is done to check boundary conditions. * A boundary value analysis is a testing technique in which the elements at the edge of the domain are selected and tested. Using boundary value analysis, instead of focusing on input conditions only, the test cases from output domain are also derived. * Boundary value analysis is a test case design technique that complements equivalence partitioning technique. Guidelines for boundary value analysis technique are, If the input condition specified the range bounded by values x and y, then test cases should be designed with values x and y. Also test cases should be with the values above and below x and y. 2. If input condition specifies the number of values then the test cases should be designed with minimum and maximum values as well as with the values that are just above and below the maximum and minimum should be tested. If the output condition specified the range bounded by values x and y, then test cases should be designed with values x and y. Also test cases should be with the values above and below x and y. If output condition specifies the number of values then the test cases should be designed with minimum and maximum values as well as with the values that are just above and below the maximum and minimum should be tested. If the internal program data structures specify such boundaries then the test cases Must be designed such that the values at the boundaries of data structure can be tested, * TEGANIGAL PUBLICATIONS? - an updhnst for krowedgo cipeoae rcrestiey ace Software Testing ang Mainteonaney For example : Integer D with input condition [— 2, 10], Test values : - 2, 10, 11,-1, 0 If input condition specifies a number values, test cases should developed to exercise the minimum and maximum numbers. Values just above and below this min ang a should be tested. Enumerate data E with input condition : (2, 7, 100, 102} Test values : 2, 102, - 1, 200, 7 EEEEEREEY Find tine boundary vatue test cases for the following : If x is less than level 1 go to 100 else 200. If y is greater than level 2 go to 300 else 400. Solution : [Sr. No. Test case name Test data Expected result Testing lower boundary of x Ifx= level 0 goto 100 Ifx=level 1 go to 200 2, _ Testing upper boundary of x Ifx = level 2 or more go to 200 3. Testing lower boundary of y Ify = level 1 or level 0 go to 400 Ify = level 2 go to 400 4. _ Testing upper boundary of y Ify = level 3 or more go to 300 Design a black box testing for an under water submarine. Solution : Inside submarine there are containers called ballast tanks. If ballast tanks are full of air then, the submarine will float otherwise, if water is pumped into the ballast tank then submarine will sink. To make submarine work underwater it is necessary to fill up ballast tank with water. The submarine will float, sink or rise by adjusting water and air level in ballast tank. The rudder of submarine is turned left or tight. : Test case Expected result | 1. — The ballast tank is filled with air It will above threshold level, ‘illest onthe surface of water. 2. The ballast tank is filled with water Ik way a with water above threshold. foro UPder water letting Water out, By vented Software Engineering ia Software Testing and Maintenance Fin to right side. Direction changes, in to left side, Ee Direction gets changed, ting adequate ; Sect Pe eMount of oxygen, the water ig separated out as and O Teleasing oxygen, pose Pilgit Pees state the following for an input field: The program shall accept an input onlue of 4-digit integer equal or greater than 2000 and less than or equal 8000. Determine the test cases using, ~ ivBunaence class partitioning. i) Boundary cae analysis, solution : i) Equivalence class partitioning Wecan have set of test cases which are based on input domain I, = (Integer < 2000 } I,” = {Integer = 2000} I, = { Integer > 2000 and < 8000} (Integer = 8000} I, = {Integer > 8000} Integer Expected 1900 Invalid input _| oo 2000 Valid input 5 : 5000. ~—_—~Vallid input ) Boundary Value Analysis : The boundary. values can be, ') Less than 2000 +i) Greater than and / or equal to 2000 ti) Less than and / or equal to 8000 '\) Greater than 8000. ae Object Oriented Software Engineering 4-10 Software Testing and Maloney Testcase Integer Expected output 1 1000 Invalid input 2 2000 Valid input 3 4000 Valid input Me po ae 5 9000 Invalid input Consider a program for determining the previous date. Its input is a triple of day, month and year with the values in the range 1 month 12, 1 day 31,1990 year 2014. The possible outputs would be previous date or invalid input date. Design the boundary value test cases. TAU: biey16, bane] Solution : This program takes current date as input and returns previous date as its output. There are three variables for the program ~ month, day and year. Hence there would be 4n + 1 = (4x 3) + 1 = 13 test cases that can be designed. The boundary value test cases are, [FestCase Month Day Year Expected output : ; te 1990 15 May 1990 5 i a 192 15 May 1992 4 10 1 1995, 30 September 1995 s 15 1985 Invalid date 7 2 2001 1 July 2001 3 ll 2003 10 March 2003 a 2005 28 March 2005 it 2 2007 11 November 2007 1 15 2008 14 November 2008 x 15 2008 14 January 2008 6 7 2010 16 June 2010 oO 8 16 2014 eas . ; 15 August 2014 fe es 6 2s, Invalid date | a a Dee BS aT ar nee tieennat REA oriented Software Engineer yet Onented jgtheering 4-11 Software Testing and Maintenance Given the requirements for an Automated Teller Machine (ATM) system (ce below), design the following : j) Use case diagram. ii) Activity diagram detailing each use case. iii) List test cases for any one functionality from your use case diagram. The ATM will service one customer at a time. A customer will be required to insert an ATM. card and enter a Personal Identification Number (PIN) - both of which will be sent to the © bank for validation as part of each transaction. The customer will then be able to perform one or more transactions. The ATM must be able to provide the following services to the customer : Accustomer must be able to make a cash withdrawal from any suitable account linked to the card, in multiples of $20.00. Approval must be obtained from the bank before cash is dispensed. A customer must be able to make a deposit to any account linked to the card, consisting of cash and/or checks in an envelope. The customer will enter the amount of the deposit into the ATM, subject to manual verification when the envelope is removed from the machine by an operator. Approval must be obtained from the bank before physically accepting the envelope. A customer must be able to make a transfer of money between any two accounts linked to the card. A customer must be able to make a balance inquiry of any account linked to the card. Perea Solution : i) Use case diagram AU Invalid PIN PIN, extension ‘ point -> ssinclur <> Insufficient Balance > <> ‘Check Account Balance Fig. 4.3.2 Withdrawal of money from ATM <> Dispense Money —— ATIONS®.- an up-thrust for knowledge Object Oriented Software Engineering 4-12 Software Testing ana Maictsnang ii) Activity diagram -swimiane L Bank Customer ATM System pasar SS tats I beinching <> [Balance <=Amount+500} object with change in state Fig. 4.3.3 Activity model iii) The list of test cases is as follows - Cash withdrawal operation 1) Machine does not accept the card as card is expired. 2) User enters wrong PIN. pee TT na cee cyjet Oriented Software Engineering 4-13 Software Testing and Maintenance 3) Verify that user is presented with different account type options like - saving, current etc. 4) Verify that user is only allowed to enter amount in multiples of denominations as per the specifications, 5) Verify that user is prompted to enter the amount again in case amount entered is not as per the specification and Proper message should be displayed for the same. 6) Verify that user cannot withdraw more amount than the balance. Money transfer from one account to another 1) Verify that the correct selection of the choice of transfer money from Menu. 2) Verify that the sufficient amount is present in the source account. 3) Verify that the correct account number is mentioned for transfer of amount’. 4) Verify that the correct amount is mentioned for transfer. 5) Verify that other account is linked to the card. 1. What is black box testing ? Explain the different types of black box testing strategies. Explain by considering slits erripid aneerereery 2. How do you test boundary conditions ? 3. What is boundary value analysis ? Explain the technique specifying rules and its usage with tenpgaecine COT + Describe the various black box and white box testing techniques. Use suitable examples for your explanation. AU : May-15, Marks 16 5. Explain equivalence partitioning technique with suitable example. XUX ETA et ony § With suitable example, explain boundary value analysis. White Box Testing EUERIMMYRcAUSEsrare * The white box testing is also called as structural testing. * In white box testing derivation of test cases is according to program structure. Hence knowledge of the program is used to identify additional test cases. * Objective of white box testing is to exercise all program statements. Ms) Condition Testing - * To test the logical conditions in the program module the condition testing is used. This condition can be a Boolean condition or a relational expression. '€ condition is incorrect in following situations. ') Boolean operator is incorrect, missing or extra. 4) Boolean variable is incorrect. 19. Dec.-07.11,13,14,16,17, Marks 10 FeruniZAL PUBLICATIONS® - an up-thrust for knowledge Object Oriented Software Engineering 4-14 Software Testing and Mainteneno, iii) Boolean parenthesis may be missing, incorrect or extra. iv) Error in relational operator. v) Error in arithmetic expression. * The condition testing focuses on each testing condition in the program. * The branch testing is a condition testing strategy in which for a compound condition each and every true or false branches are tested. The domain testing is a testing strategy in which relational expression can be tested using three or four tests. Loop Testing Loop testing is a white box testing technique which is used to test the loop constructs. Basically there are four types of loops. 1. Simple loops : The tests can be performed for n number of classes. if, i) n=0 that means skip the loop completely. ii) n=1 that means one pass through the loop is tested. iii) n= 2 that means two passes through the loop is tested. iv) n= m that means testing is done when there are m passes where m top, {mia} == key amid]! = [mid] > key regions Fig. 4.4.6 TECHNICAL PUBLIGATIONS® - an up-thrust for knowiedge ire ‘Software Testing and Maintoneney Object Oriented Software Engineering 2 e cyclomatic complexity. ean en can be computed by three ways. | 1) Cyclomatic complexity = Total number of regions in the flow graph = 4 (note that in above flow graph regions are given by shaded roman letters). 2) Cyclomatic complexity = E - N + 2 = 13 edges - 11 nodes +2 =24+2=4 3) Cyclomatic complexity = P + 1=3 +1=4. There are 3 predicate (decision making) nodes : Nodes 3, 5 and 8. ‘Step 3 : Select a basis set of path. The basis paths are Path 1:1,2,3,4,5,6,7, 11 Path 2:1, 2,3, 11 Path3:1,2,3,4,5,8,9,3... Path 4:1,2,3,4,5,8, 10,3... ‘Step 4 : Generate test cases for these paths. After computing cyclomatic complexi ty and finding independent basis paths, the test cases has to be executed for these paths. The format for test case is - Preconditions : Test Test Test case Test steps Test case Test Defect case id case description Status Priority severity ; name (Pass/Fail) Step Expected Actual TECHNICAL PUBLICATIONS® an up prasige Software Testing and Maintenance pur [+ pau = wong 195 anqea fox < [pane >st{paule st qwoura|g, aBessout quud vip anpea Aoy = [pra]e sr ‘Kay on penba nea fay or renbo st Kexre yo raw» aIppaa pr SuppayD (ara) udisoq, smyers Suump ng ann aq ttm doy = > wonog Ayen Tuy poyoodxa UORTPUOD SIL, doo} arin 49 = wor0q 195 sdois oy sanpex pur won tp Suppoy.y uopdyosep edoys 3501, [see + Object Oriented Software Engineering 4-20 Software Testing and Maintenene, Write a program for sorting of n numbers. Draw the flowchart, flowgraph, fing out the cyclomatic complexity. Solution : #include #include int n; . void main{ ) f int i,A[10}; int j,temp; printf("\n\t\t Bubble Sort\n"); printf("\n How many elements are there?"); Scanf(‘%d",8n); printf("\n Enter the elements\n"); for(i=O;iAfj+1)) { 17. temp=A{j); < 18. AfiJ=Ali+4]; "The flow graph for above program is as shown in Fi : ; Fa Stown in Fig. 4.4.7. (See Fig, 4.4.7 on net mee "ction. Find Prime(al J) prints a mumber-if Sr4ph, calculate the cyclomatic complexity ad Software Té or P+t =6+t 27 The predicate nodes P are 9, 10, 11, 13, 15, 21 Thus the cyclomatic complexity is 7. Fig. 44.7 ‘and Maintenance TECHNICAL PUBLICA’ ‘TIONS® - an up-thrust for knowledge eariag 4-22 Software Testing ang. Mein, ‘. Engin Object Oriented Software Solution : Void Find Prime (int al}, int n) { 1. iso 2. while (i afi] Software Testing and Maintenance —~ Object Oriented Software Engineering 4-24 Software Testing and Mainten ance Test case Pre condition : i) a[ ] stores number to be tested. ii) j denotes any number within a range to test divisibility. Test case name Description Step Divisibility by remainder is zero rem = afi] % j othernumber when number ina[]is where j0) 9 p++; /* number of positive numbers */ 10. else 11. nn++;* number of negative numbers */ as TECHNICAL PUBLICATIONS® - an up-thniet fxr ima - iented Software Engineering for(i = 0; isnj i++) 4a. iflalil¥2 = = 0) 4 Rett 45, else 16 ROE 17, printf (‘Number of zeros %d', nz); 18. printf (‘Number of positivé %a", np): 19. printf (Number of negatives %d", nn); 20. printf ("Number of even %d, ne); 21, printf (‘Number of odd %d’, no); } Step 2: We will draw the flow graph from above code. It is as follows - (Gee Fig. 4.4.9 on next page.) Step 3: Some of the independent paths for testing are - PathI: 1,2,3,4,5,6,7,5, 12, 13, 15, 16, 12, 17, 18, 19, 20, 21. Path II: 1,2,3, 4,5, 6, 8,9, 5, 12, 13, 15, 16, 12, 17, 18, 19, 20, 21. Path III: 1, 2, 3, 4, 5, 6, 8, 10, 11, 5, 12, 13, 15, 16, 12, 17, 18, 19, 20, 21. Path IV: 1,2, 3, 4,5, 12, 17, 18, 19, 20, 21. Step 4: The cyclomatic complexity can be computed as follows - Method 1: Number of edges (E) = 25 Number of vertices (N) = 21 Cyclomatic complexity = E-N+2 = 25-21+2 =6 Method 2 : The total number of regions in Fig. 44.9 =6 Hence cyclomatic complexity = 6. Note that the area outside the graph is also treated as one region. Hence VI is marked as a region, along with all other closed loops. i =5 Method 3 : Number of predicate nodes (P) : Because node 5, 6, 8, 12, 13 are predicate nodes eer Cyclomatic complexity = P* = 5+1 =6 Thus the cyclomatic complexity is 6 vst for knowledge TECHNICAL PUBLICA Tions® - an uP! Software Testing and. Maintens, ering aa o Engine Object Oriented Software. Note : Regions are denoted by roman letters Fig. 4.4.9 TECHNICAL PUBLICATIONS® - an Up-thnst for knowiaan— iented Software Engineering . cojeot On ~ 4-27 Software Testing and Maintenance poe Consider the following program segment m is the number the functi y : pin. search (int num) function searches in a resorted integer array arr*/ o min, max; min = 0; max = 100; while (min! = max) ifarrlmin + max]/2) > num max = (min + max) /2; alse if (arrl(min + max)/2] min = (min + max)/2; else return ((min + max)/2); } return (- 1); } i) Draw the control flow graph for this program segment. ii) Define cyclomatic complexity, iti) Determine the cyclomatic complexity for this program. Show the intermediate steps in your computation. Writing only the final result is not sufficient. rr Solution : i) We will number the program statements as follows intbin_search (int num) { 1) intmin, max; min = 0; max = 100; 2) while (min! = max) 9) if(arfmin + maxj/2) > num 9 max = (min + max) /2; 5) else if (arri(min + max)/2} § min = (min + max)/2; ; Re (Gmin + max)/2); ymca The Control Flow Graph(CFG) is as follows - (Refer Fig. 44.10) ii) Cyclomatic complexity : The cyclomatic complexity is coated as the number of independent paths in the basis set of programs that provides the upper bound for the number of tests that must be conducted to ensure that all the statements have been executed atleast once. + Cyclomatic complexity =E-N+2=14-9+2"7 Total number of regions =7 Software Testir ( Object Oriented Software Engineering 4228. men Matronans, t Region Vil Fig. 4.4.10 EEERIIEER Design test case for the following program : GCD(X,Y); if X = Y, then X else if X>Y, then GCD(X-Y,Y) else GCD(X,Y-X) end if end if COTA Solution : The typical format of writing the testis as given below. Precondition : If any precondition is required then mention it. Testing steps Test Test Test Step Expected Actuay | oeee Prioriy savaay result result ‘a (Pass/ Fail) Precondition : The two non-zero Preco numbers should be entered for obtaining the GCD TECH Yr oriented Software Engineering . net - $-29 Software Testing and Maintenance Test Test case T — [Te* case description esting steps Test Tost OTe a e case priority sever /id_nam status | Step Expected Actual - (Pass/ | result result Fail) | Pio xe¥ If the value Enter The GCD - ofboth the two | is value of | numbers is numbers x, | same. such. that X=Y. 2 X>y _ Tffirst Enter Call | number is two recursive Sreater than numbers routine by the second such setting ! one. that X=x-Y value of and Y as it Xis>Y. is, 13. Xey_— Ue first Enter Call : ine wo Peon less than the. numbers routine by second one. such setting X that asitis value of and i xA good testis said to be “best of breed”. The 8 of uncoverin, g errors. ek Teg 8004 test must not be too simple not too complex. “S*ease design : Refer section 4.43. TEGHNIGAL PUBLIGATIONS®- an upthist fr krowedge Sti Object Oriented Software Engineering 4-30 Software Testing and Mainten an, SEITE consi the pseudo code for simple aubiraction given below 1) Program ‘Simple substraction’ 2) Input (x, y) 3) Output (x) 4) Output (y) 5) Ifx > y then DO 6)x-y=z 7) Else y-x =z 8) Endif 9) Output (2) 10) Output “End Program” Perform basis path testing and generate test cases. Solution : Step 1: We will first draw the flow graph for given pseudo code. This flow graph is as shown in Fig. 4.4.11. Step 2: We will compute cyclomatic complexity using following formula = e- V +2 where e is total number of edges, V is total number of vertices 9-942 = 2 Now we will find two independent paths for basis path testing. Step 3: Pathl = 2-3-4-5-6-8-9-19 Path2 = 2-3-4-5-7-g_-9_19 Step 4: The test cases for these paths are as given below Fig. 4.4.11 ( ted Software Engineering . Oe 4-31 Software Testing and Maintenance ite : i poe ne “ piped Tor the following : Given three sides of a triangle, return the of triangle i.e. equilateral, isosceles and scalene triangle. Draw the control flow graph and calculate cyclomatic complexity to calculate the minimum num the paths to be tested. ber 2 ieee Enumerate con! 1: ill wri ston: Step ba will write the procedure for finding the type of triangle. Each important step is num| red so that we can draw the flow graph in the next step (ijint mate QO at pinta, bo status = 0; (a)printt ("nt Enter side a :"); scant ("%ed", & a); (@pint(nt Enter side b :"); : {scant (%C", & b): (@printf ("nt Enter side (9) scanf ("%d", &c); (10) if ((a> 0) && (a <- 100) && (b > 0) &&(b<. = (M1)if (@ +b) > c) && ((C + a) > b) && ie .S o ay Co. (12) status = 1; (13)} (14)} (15) else { (16) status (17) (18) f (status = = 1) { (19) (@ = =b) 88 (b = =0)) { i en (‘Triangle is equilateral"); (2) else if (a = =p) = =b) 11 (b= = 0) 11( Pree iia i a Triangle is isosceles"); 2 else { 08) 9 be yet Trangle is scalene"); (28)) (2) else i to) = if (status = = 0) ¢ 6) se (Not a triangle"); (92) cise » print ¢n ayy nt 'nvalid input range"); 85) oe : ‘ich ( ). €8ren Qo" me Software Testing and iy ; lot ete Step 2: Now the flow graph is designed as follows - Object Oriented Software Engineering 4-32 ayert onentod SOMWETE. Engineering 4033. Software Testing and Maintenance step 3: The Decision to Decision path(DD Path) is drawn from the above flow graph. satis eraph we only concentrate on decision nodes, the sequential nodes are combined gener into one rode. The DD path graph is as shown below - Step 3: ; *P 3: Computing the cyclomatic complexity as follows - Method 1: Cyclomatic complexity = E-N +2 where E i "amber of nodes ene is number of edges and N are = 23-18+2 7 Meth 0d 2 : Cyclomatic complexity =P + 1 where Pis a predicate node 6 +1 where b, c gh, j and n are predicate nodes 7 TECHNICAL PUBLICATIONS® Object Oriented Software Engineering 4-34 Software Testing 8nd Maintonangs Method 3: Cyclomatic complexity = Number of regions +1 = 6+1 =7 Thus the cyclomatic complexity is 7 Step 4: The independent paths to be tested are - (1) abfgnpqr 2 abfgnoqr (3) abcegnpqr (4) abedegnogr (6) abfghimqr (6) abfghjkmqr (7) abfghjlmqr Rucuae Uns) 1. What is white box testing ? Explain. 2. Explain how the various types of loops are tested. EE Testing Strategies + We begin by ‘testing-in-the-small’ and move toward ‘testing-in-the-large’. * Various testing strategies for conventional software are 1. Unit testing 2. Integration testing 3. Validation testing 4. System testing . Unit testing - In this type of testing techniques are applied to detect the errors from each software component individually. - Integration testing - It focuses on issues associated with verification and progr construction as components begin interacting with one another. 3. Validation testing - It provides assurance that the software validation crte® (established during requirements analysis) meets all functional, behavioural ad performance requirements, . . System testing - In system testing all system elements forming the system is tested as a whole. ented SOMWATE Engineering : 4-35 Strategies Validation testing Integration testing Black box testing Software Testing and Maintenance Software development stages [System engineering] Requirements Design Code Fig. 4.5.1 Testing strategy > Difference between black box testing and White box testing White box testing Black box testing is the software testing method which is used to test the software without knowing the internal structure of code or program. This type of testing is carried out by testers. out by software developers. : White box testing is the software testing method in which internal structure is being known to tester who is going to test the software. Generally, this type of testing is carried Implementation knowledge is not required Implementation knowledge is required carry out black box testing ebleneriaton nore to carry out white box testing, i a; Se * jred to Programming knowledge is required to | Programming knowledge is not requir carry out white box testing. Q x levels of Testing i i highes ig is applicable on high¢ cerptancs testing like system testing, testing, a "Testing is applicable on lower level testing like unit testing, integratior testing. ss Object Oriented Software Engineering 4-36 Black box testing means functional test or external testing. Black box testing can be started based on requirement specifications documents. The functional testing, behavior testing, close box testing is carried out under black box testing. Software Testing and i lotenang, White box testing means stra, ct interior testing, ral aD Be Pel White box testing can be starteg detail design documents, based The Structural testing, logic testin, testing, loop testing, code eye testing, open box testing is cartiog “e under white box testing. | 1. Explain the various levels of software testing with suitable examples. CEES | Unit Testing © In unit testing the individual components are tested independently to ensure their quality. AU : Dec.-06,08,15, May-03,09, Marks 16 The focus is to uncover the errors in design and implementation. The various tests that are conducted during the unit test are described as below. 1. Module interfaces are tested for proper information flow in and out of the program. 2. Local data are examined to ensure that integrity is maintained. 3. Boundary conditions are tested to ensure that the module operates properly at boundaries established to limit or restrict Processing. 4. All the basis (independent) paths are tested for ensuring that all statements it the module have been executed only once. 5. All error handling paths should be tested. Source program Various ~ modules in program /'* Local. data \* Independent path Things to be tested (interfaces Generating =) Icases| Structures ‘ \ * Boundary condition | ! H ‘Error handling paths” . 7 cnented Software Engineering 4-37 Software Testing and Maintenance 6, Drivers and stub software need to be developed to test incomplete software. The «driver” is a program that accepts the test data and prints the relevant results. And the “stub” is a subprogram that uses the module interfaces and performs the minimal data manipulation if required. This is illustrated by following Fig. 4.6.2. 77 Interface + Local data structures : ‘Boundary conditions} \. Independent paths *< Error handling paths ” Fig. 4.6.2 Unit testing environment 7. The unit testing is simplified when a component with high cohesion (with one function) is designed. In such a design the number of test cases are less and one can easily predict or uncover errors. Bl integration Testing FXG * A group of dependent components are tested together to ensure their quality of their integration unit. Dec.-06,08,15,19, May-03,04,05,09,13,14,15,17,18, Marks 16 * The objective is to take unit tested components and build a program structure that has been dictated by software design. * The focus of integration testing is to uncover errors in "Design and construction of software architecture. * Integrated functions or operations at subsystem level. * Interfaces and interactions between them. * Resource integration and/or environment integration. * The integration testing can be carried out using two approaches. \Thenon-incremental integration 2. Incremental integration. TECHNICAL PUBLICATIONS® - an up-thrust for knowledge 4-38 Sofware Testing ard Maitenn, Incremental integration | -— Top down testing Non-incremental integration |— Bottom up integration |-— Regression testing L_. smoke testing Fig. 4.7.1 Integration testing approach © The non-incremental integration is given by the “big bang” approach. All components are combined in advance. The entire program is tested as a whole. And chaos usually results. A set of errors is tested as a whole. Correction is difficult because isolation of causes is complicated by the size of the entire program. Once these errors aré corrected new ones appear. This process continues infinitely. Advantage of big-bang : This approach is simple. Disadvantages : 1. It is hard to debug. 2. Itis not easy to isolate errors while testing. 3. In this approach it is not easy to validate test results, 4. After performing testing, it is impossible to form an integrated system. * An incremental construction strategy includes, Top down integration Bottom up integration Regression testing Smoke testing. The outcome of integration testing is Errors in design and construction of software architecture. * Errors from integrated functions or operations at sub- * Errors from interfaces and interactions between them. * Errors in resource integration and environment integration. ‘system level. Bi iiieiaia Se a ented Software Engineerin yet oriented 9 4-39 Software Testing and Maintenance ., The system test is a series of tests conducted to fully exercise the computer based system. Top Down Integration Testing « Top down testing is an incremental approach in which modules are integrated by moving down through the control structure. «+ Modules subordinate to the main control module are incorporated into the system ineither a depth first or breadth first manner. « Integration process can be performed using following steps. 1. The main control module is used as a test driver and the stubs are substituted for all modules directly subordinate to the main control module. 2. Subordinate stubs are replaced one at a time with actual modules using either depth first or breadth first method. 3. Tests are conducted as each module is integrated. 4, On completion of each set of tests, another stub is replaced with the real module. 5, Regression testing is conducted to prevent the introduction of new errors. Forexample : Fig. 4.7.2 Program structure ie ‘op down integration if the depth first approach is adopted then we will start von from module M1 then we will integrate M2 then M3, Md, M5, M6 and then If an a - Me nah first approach is adopted then we will integrate module M1 first then M2, “Then we will integrate module M3, M4, M5 and finally M7. a Oriented Software Engineering 4-40 Software Testing and Meinteneng, Object Bottom Up Integration Testing In bottom up integration the modules at the lowest levels are integrated at first, then integration is done by moving upward through the control structure. The bottom up integration process can be carried out using following steps. 1. Low-level modules are combined into clusters that perform a specific software subfunction. 2. A driver program is written to co-ordinate test case input and output. The whole cluster is tested. Drivers are removed and clusters are combined moving upward in the program structure. Ye For example : Cluster 4 Cluster 2 Fig. 4.7.3 Bottom up integration testing First components are coll ; lected together to f cluster is tested usi ‘ ‘© form cluster 1 and ch ich After testing the ree 2 driver program. The clusters subordinat. Saas q me Fa ‘er is removed and clusters are directly interf, oi e driver module. ‘aced to the modules. ‘ented Sofware Engineering 7 os Software Testing and Maintenance sone between top down and bottom up integration testing : Top-down Integration Bottom-up Integration ig. NO ; — pee ele oF decisions are verified’ “After integrating all the components at the| eee : bottom level, major contols or decisions can| be verified. [2 Testing can be performed from the early Individual components can be tested at p | ered higher level, but after integration of low levell i components into cluster testing is required. | [7a In top-down testing, testing “stubs are In botomup testing, test drivers arel } =a required. 4 | + as system can be available at early Wetioe system is available only after| = grating all the components. | [ib Regression Testing « Regression testing is used to check for defects propagated to other modules by changes made to existing program. Thus regression testing is used to reduce the side effects of the changes. + There are three different classes of test cases involved in regression testing - o Representative sample of existing test cases is used to exercise all software functions. o Additional test cases focusing software functions likely to be affected by the change. © Tests cases that focus on the changed software components. * After product had been deployed, regression testing would be necessary because after a change has been made to the product an error that can be discovered and it should be corrected. Similarly for deployed product addition of new feature may be Tequested and implemented. For that reason regression testing is essential. BW smoke Testing , , * The smoke testing is a kind of integration testing technique used for time critical Projects wherein the project needs to be assessed on frequent basis. * Following activities need to be carried out in smoke testing - 1. Software components already translated into code are integrated into a “build”. The “build” vas tbe. data files, libraries, reusable modules or program “omponents, “build” 2 A series of tests are designed to expose errors from build so that the “build Performs its functioning correctly. 15®- an up-thnust for knowledge TION! EE ™ Toul Object Oriented Software Engineering 4-42 Software Testing and Wate 3, The “build” is integrated with the other builds and the entire product is ake tested daily. Smoke testing benefits 1, Integration risk is minimized. 2. The quality of the end product is improved. 3. Error diagnosis and correction are simplified. 4. Assessment of progress is easy. iew Que: 1. What is meant by integration testing and system testing ? Explain. Discuss on their outcomes, Ce eed What is integration testing ? Discuss any one method in detail. AU : May-17, Marks 8 Explain unii testing and integration testing process with an example. GAUR@AIIES EAMES) 2. a 4. Write short note on - Regression testing. Pe ence cre CLC 5. Elaborate path testing and regression testing with an example. Cree 6. Discuss about the integration techniques with suitable example. EE] system Testing ee eee The system test is a series of tests conducted for fully the computer based system. Various types of system tests are 1. Recovery testing 2. Security testing 3. Stress testing 4. Performance testing The main focus of such testing is to test = System functions and performance. = System reliability and recoverability (recovery test). = System installation (installation test). * System behaviour in the special conditions (stress test) System user operations (acceptance test/alpha test). Hardware and software integration and collaboration. Integration of external software and the system. a Software E: cajat Onanted Software Engineering 4-43 Software Testing and Maintenance Recovery Testing « Recovery testing is intended to check the system’s ability to recover from failures. + Inthis type of testing the software is forced to fail and then it is verified whether the system recovers properly or not, « For automated recovery then Teinitialization, ch and restart are verified, oa Security Testing « Security testing verifies that system protection mechanism prevent improper penetration or data alteration, ‘eckpoint mechanisms, data recovery * It also verifies that protection mechanisms built into the system prevent intrusion such as unauthorized internal or external access or willful damage. * System design goal is to make the penetration attempt more costly than the value of the information that will be obtained. Stress Testing * Determines breakpoint of a system to establish maximum service level, * In stress testing the system is executed in a manner that demands resources in abnormal quantity, frequency or volume. * A variation of stress testing is a technique called sensitivity testing. * The sensitive testing is a testing in which it is tried to uncover data from a large class of valid data that may cause instability or improper Processing. ay Performance Testing * Performance testing evaluates the run time performance of the software, especially Teal time software. * In performance testing resource utilization such as CPU load, throughput, response time, memory usage can be measured. * For big systems (e.g. banking systems) involving many users connecting to servers €g. using internet) performance testing is very difficult. * Beta testing is useful for performance testing. © What i . CCE] | What is system testing ? Discuss types of system tests 8 an up-thrist for kno TEGHNIGAL PUBLICATIONS® - an up-th wedge oe sane que Software Testing and iy t Oriented Software Validation Testing i ents to ensure th. © The integrated software is tested based on requirem« at the den product is obtained. it is rs in « In validation testing the main focus is to uncover erro - System input/output - System functions and information data - System interfaces with external parts ~ User interfaces - System behaviour and performance. © Software validation can be performed through a series of black box tests. ¢ After performing the validation tests there exists two conditions. 1. The function or performance characteristics are according to the specifications and are accepted. 2. The requirement specifications are derived and the deficiency list is created. The deficiencies then can be resolved by establishing the proper communication with the customer. * Finally in validation testing a review is taken to ensure that all the elements of software configuration are developed as per requirements. This review is called configuration review or audit. Acceptance Testing The acceptance testing is a kind of testing conducted to ensure that the software works correctly in the user work environment, The acceptance testing can be conducted over a period of weeks or months. The types of acceptance testing are 1. Alpha test - The alpha testing is a testing in which the version of comple? software is tested by the customer under the supervision of developer. TH formed at developer's site, The software is used in natural setting " Presence of developer. This test is conducted in controlled environment. Advantages 1. The users of the system get systematic trainin, ig to use the tem. 2. The acceptance of the 5 rode ‘stem can be immediately known to the developer TECHNICAL PUBLICATIONS® an up-thrust for knowledge

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy