Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

White Box Testing V0.2

9,551 views

Published on

presented during 2 days seminar on software testing in vellalar college, erode

Published in: Economy & Finance, Technology
  • Be the first to comment

White Box Testing V0.2

  1. 1. White box testing
  2. 2. Objective <ul><li>What is White box testing </li></ul><ul><li>Techniques of white box testing </li></ul><ul><li>What is Grey Box testing </li></ul>
  3. 3. <ul><li>Testing the internal structure of the software </li></ul><ul><li>Understand the code and the code will set you free! </li></ul><ul><li>White-box testing is testing that takes into account the internal mechanism of a system or component </li></ul><ul><li>It’s also known as Structural testing, clear box testing and glass box testing </li></ul>What is it?
  4. 4. Techniques <ul><li>Statement coverage </li></ul><ul><li>Loop testing </li></ul><ul><li>Path testing </li></ul><ul><li>Branch testing </li></ul>
  5. 5. Statement Coverage <ul><li>100% method coverage: All methods in all classes are called. </li></ul><ul><li>100% statement coverage: All statements in a method are executed. </li></ul><ul><li>void foo (int a, b, c, d, e) { </li></ul><ul><li>if (a == 0) { </li></ul><ul><li>return; } </li></ul><ul><li>int x = 0; </li></ul><ul><li>if ((a==b) OR ((c==d) AND bug(a) )) { </li></ul><ul><li>x =1; } </li></ul><ul><li>e = 1/x; } </li></ul>
  6. 6. Loop testing <ul><li>Test the ‘ for’ and ‘ while’ loops in the code. </li></ul><ul><li>Look for exceptions of infinite loop. </li></ul><ul><li>Cause execution of loop to be skipped. </li></ul><ul><li>Loop to be executed exactly once. </li></ul><ul><li>Loop to be executed more than once </li></ul>
  7. 7. Path testing <ul><li>Make sure all the paths are covered. </li></ul><ul><li>Determine the paths </li></ul><ul><li>Construct a logic flow chart </li></ul>
  8. 8. Path testing: Determine Paths <ul><li>FindMean (FILE ScoreFile) </li></ul><ul><li>{ float SumOfScores = 0.0; </li></ul><ul><ul><li>int NumberOfScores = 0; </li></ul></ul><ul><ul><li>float Mean=0.0; float Score; </li></ul></ul><ul><ul><li>Read(ScoreFile, Score); </li></ul></ul><ul><ul><li>while (! EOF(ScoreFile) { </li></ul></ul><ul><ul><ul><li>if (Score > 0.0 ) { </li></ul></ul></ul><ul><ul><ul><ul><ul><li>SumOfScores = SumOfScores + Score; </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>NumberOfScores++; </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>} </li></ul></ul></ul></ul></ul><ul><ul><ul><li>Read(ScoreFile, Score); </li></ul></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>/* Compute the mean and print the result */ </li></ul></ul><ul><ul><li>if (NumberOfScores > 0) { </li></ul></ul><ul><ul><ul><ul><li>Mean = SumOfScores / NumberOfScores; </li></ul></ul></ul></ul><ul><ul><ul><ul><li>printf(“ The mean score is %f ”, Mean); </li></ul></ul></ul></ul><ul><ul><li>} else </li></ul></ul><ul><ul><ul><ul><li>printf (“No scores found in file ”); </li></ul></ul></ul></ul><ul><li>} </li></ul>1 2 3 4 5 7 6 8 9
  9. 9. Path testing: Logic flow diagram
  10. 10. Branch testing <ul><li>Also known as Conditional Testing </li></ul><ul><li>Make sure that each possible outcome from a condition is tested at least once. </li></ul><ul><li>if (i=true) </li></ul><ul><li> printf (“I am true”) </li></ul><ul><li>else </li></ul><ul><li> printf (“I am false”) </li></ul><ul><li>Possible Testcases are </li></ul><ul><li>1. i=true; 2. i=false </li></ul>
  11. 11. Grey box testing <ul><li>What is it? </li></ul><ul><ul><li>Mixture of both black box and white box. </li></ul></ul><ul><ul><li>Test the system with a basic outlook of internals. </li></ul></ul><ul><li>When you do? </li></ul><ul><ul><li>Once the functionality is developed </li></ul></ul><ul><li>Example </li></ul><ul><ul><li>Database testing </li></ul></ul><ul><ul><li>Using SQL </li></ul></ul>
  12. 12. Grey box testing: SQL <ul><li>Some times testers may have to use SQL to help in the black box testing. </li></ul><ul><li>Types of Grey box using SQL </li></ul><ul><ul><li>Data Validation </li></ul></ul><ul><ul><li>Data security </li></ul></ul><ul><ul><li>Query for system updates </li></ul></ul>
  13. 13. Grey box testing: My examples <ul><li>Testing I did! </li></ul><ul><ul><li>Test the inventory by using the inventory table </li></ul></ul><ul><ul><li>Reservation retrieval </li></ul></ul><ul><ul><li>Data encryption: Credit Card number </li></ul></ul>
  14. 14. Questions?

×