Your SlideShare is downloading. ×
  • Like
10 software testing_technique
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply
Published

Principles of Software Engineering by Utpal Roy, Jadavpur University, Kolkata, India

Principles of Software Engineering by Utpal Roy, Jadavpur University, Kolkata, India

Published in Education , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,723
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
126
Comments
0
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Software Testing Technique White Box and Black Box Testing TechniqueJanuary 13, 2012 Made By Utpal Ray 1
  • 2. Software Testing Technique Testing Objective 1. Testing is a process of executing program ( test program ) with an intention of finding errors ( bugs ). 2. A good test case is one that has a high probability of finding an as- yet-undiscovered error. 3. A successful test is the one that has uncovered an as-yet- undiscovered error.January 13, 2012 Made By Utpal Ray 2
  • 3. Software Testing Technique Testing Principles 1. All tests should be traceable to customer requirements. 2. Test planning and test preparation should be planned long before testing begins. 3. Test case should be designed keeping the ‘Pareto’ principle in mind which states that, 80% of all the errors uncovered during the testing process are located within the 20% of the program components. 4. Exhaustive testing is never possible because of resource ( man- power, time, money etc. ) constraints.January 13, 2012 Made By Utpal Ray 3
  • 4. Software Testing Technique Testability – what it is ? How easily a computer program can be tested. How adequately a particular set of tests will cover the product. How easily the product can be checked and repaired in the field.January 13, 2012 Made By Utpal Ray 4
  • 5. Software Testing Technique Test Case Design  Test case should be designed keeping two test situations in mind. They are :- 1. White Box Testing 2. Black Box TestingJanuary 13, 2012 Made By Utpal Ray 5
  • 6. Software Testing Technique White Box Testing This method of testing assumes, the tester has a good knowledge about the source code which is under consideration for testing. Depending upon the structure of the source code, the test cases are designed. Each of the test case is supposed to test a unique path through the code. This method of testing is also called Basis Path Testing.January 13, 2012 Made By Utpal Ray 6
  • 7. Software Testing Technique White Box Testing (contd.)  Let’s take an example program of which we need to design test cases for white box testing. int find_max ( int a, int b, int c ) { int max; if ( a>b ) then max=a; else max=b; if ( max<c ) then max=c; return max; }January 13, 2012 Made By Utpal Ray 7
  • 8. Software Testing Technique White Box Testing (contd.) Flow Chart of the Previous Program 1 Declare a,b,c;Define max T 2 a>b Max = a 3 F 4 Max = b T 5 max<c Max=c 6 F 7 Return maxJanuary 13, 2012 Made By Utpal Ray 8
  • 9. Software Testing Technique White Box Testing (contd.) Cyclomatic Complexity Before we proceed to write the test cases we have to know how many test cases will be there at the most. This can be known by a software metric called ‘Cylomatic Complexity’. The Cyclomatic Complexity provides the quantitative measure of the logical complexity of a program. With regard to white box testing, cyclomatic complexity gives us the upper bound for the number of tests that must be conducted to ensure that all statements have been executed at least once.January 13, 2012 Made By Utpal Ray 9
  • 10. Software Testing Technique White Box Testing (contd.) Cyclomatic Complexity The Cyclomatic Complexity can be computed by adding one to the total number of decision box in the program. As for the program mentioned before, there are 2 decision box shown in the flow chart. So, the cyclomatic complexity is 2+1=3. So, at the most there are three independent path in the program. To find out those independent path, we have to convert the flow chart to flow graph.January 13, 2012 Made By Utpal Ray 10
  • 11. Software Testing Technique White Box Testing (contd.) Rules for Flow Chart to Flow Graph Conversion All the process box and the decision diamond should be numbered in the flow chart. A decision diamond should map to a node. A single process box or a sequence of process box should map to a single node. A process box and a decision box can be mapped together to a single node also. The flow should map to a link or edge between the nodes. An edge must terminate to a node, even if the node does not represent any procedural statement.January 13, 2012 Made By Utpal Ray 11
  • 12. Software Testing Technique White Box Testing (contd.) 1,2 An independent path is a path, where At least one edge has not been traversed 4 Before. With this rule, we get 3 independent 3 Path. They are :- 1. 1,2  3  5  7 2. 1,2  4  5  7 5 3. 1,2  3  5  6  7 Since, the cyclomatic complexity for this 6 Flow graph is 3; there cannot be more than 3 independent path. 7 Flow GraphJanuary 13, 2012 Made By Utpal Ray 12
  • 13. Software Testing Technique White Box Testing (contd.) Test Cases for the previous program Test Case 1 [ for the path 1 ] Input : a>b; a>c Expected Output : a Test Case 2 [ for the path 2 ] Input : b>a; b>c Expected Output : b Test Case 3 [ for the path 3 ] Input : c>a; c>b Expected Output : cJanuary 13, 2012 Made By Utpal Ray 13
  • 14. Software Testing Technique Black Box Testing It is also known as behavioral testing It focuses on the functional requirement of the software. It is complementary rather then alternative to white box testing. Black Box Testing is performed during the later stages of the software testing; unlike white box testing which is performed during the early stages of software testing.January 13, 2012 Made By Utpal Ray 14
  • 15. Software Testing Technique Black Box Testing (contd.) The reason for doing black box testing 1. It uncovers incorrect or missing functions. 2. It detects interface errors. 3. It can detect internal data structure errors or external data base errors. 4. It can point out whether performance of the software is below the desired level. 5. It can spot initialization or termination error.January 13, 2012 Made By Utpal Ray 15
  • 16. Software Testing Technique  Black Box Testing (contd.) Test Case Design for Black Box Testing 1. Design test cases in such a way, so that it covers all the functional requirements of the software. 2. Design test cases to test the performance criteria of the software. 3. Design test cases to test the most frequently used inputs given by the user. 4. Design test cases to test the sensitive inputs given by the user.January 13, 2012 Made By Utpal Ray 16
  • 17. Software Testing Technique  Black Box Testing (contd.) Test Case Design for Black Box Testing (contd.) 5. Design test cases to test the boundary condition of the software. 6. Design test cases to test the behavior of the software for reasonable amount of negative inputs. 7. Design test cases to test the maximum load and stress capability of the software. 8. Design test cases to test the security aspects of the software.January 13, 2012 Made By Utpal Ray 17
  • 18. Software Testing Technique  Loop Testing Testing Technique :- 1. Skip the loop entirely. 2. Only one pass through the loop. 3. Two passes through the loop. 4. If n is the maximum no of allowable passes through the loop, then m passes ( m<n ) through the loop. 5. n-1, n, n+1 passes through the loop. Simple LoopJanuary 13, 2012 Made By Utpal Ray 18
  • 19. Software Testing Technique  Loop Testing ( contd. ) Testing Technique :- 1. Start at innermost loop. Set all outer loops to minimum values. 2. Conduct simple loop tests for innermost loop. 3. Work outward, conducting tests for the next loop, but keeping all other outer loops at minimum values and other nested loops to typical values. 4. Continue until all loops have been tested. Nested LoopJanuary 13, 2012 Made By Utpal Ray 19
  • 20. Software Testing Technique  Home Task A. Design test cases for white box testing for the following set of Programs mentioned below. 1. An array contains n number of integers. Find the maximum number from that array. 2. A program reads 3 integer values. The 3 values represents the 3 sides of a triangle. The program prints a message telling whether the triangle is scalene, isosceles, or equilateral. B. Design test cases for black box testing for the program shown in the beginning of this class.January 13, 2012 Made By Utpal Ray 20