O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Black Box Testing.pdf

Próximos SlideShares
Carregando em…3

Confira estes a seguir

1 de 44 Anúncio

Mais Conteúdo rRelacionado

Mais recentes (20)


Black Box Testing.pdf

  2. 2. Box
  3. 3. Black Box Testing • Black-box testing: Testing, either functional or non-functional, without reference to the internal structure of the component or system. (ISTQB)
  4. 4. Test Execution Black Box Testing – testing without knowing the internal workings of thecode – WHAT a system does, rather than HOW it works it – typically used at System Test phase, although can be useful throughout the test lifecycle – also known as specification based testing andfunction testing – Applies for Functional and Non-Functional testing Input Output If Output = Expected result then pass
  5. 5. White Box Testing white-box testing: Testing based on an analysis of the internal structure of the component or system. (ISTQB)
  6. 6. White Box Testing – testing based upon the structure of the code – typically undertaken at Component and Component Integration Test phases by development teams – also known as structural or glass box testingor structure based testing Execute with monitor the flow Input Output
  7. 7. Test Case Design • Terminologies – Test condition – an item or event of a component or system that could be verified by one or more test cases – Test case specification– a set of input values, execution preconditions, expected results, and executionpostconditions, designed for a specific test objective or test condition – A test procedure specification – a sequence of actions for the execution of the test. It may consist of number of test cases. – Test basis: All documents from which the SRS, SDS, code, or any related documents of a component or a system can be inferred. 6
  8. 8. Test Case s Test Procedure Specification or Manual Test Script Priority Test Conditions, Cases, Procedures and Schedule What How How When Test Execution Schedule Automated Test Script Test Condition Sourced Documentation Test Cases S Test Procedure pecifications
  9. 9. Illustrative Example of Test Case Design -1 Inorderfor3integersa,b,andctobethe sides of a triangle, the following conditions must bemet: Scalene: a+b>c,wherea<b<c Isosceles: a+a>c,whereb=a Equilateral:a=a=a,whereb=a,c=a,anda>0 A triangle is: Scalene if no two sides are equal Isoscelesif2sidesareequal Equilateral if all 3 sides are equal void triangle (int a, int b, int c) { int min,med, max; if (a>b) { max=a; min = b; } else { max = b; min = a; } if (c>max) max = c; else if (c<max) min = c; med = a+b+c-min-max; if (max>min+med) cout << "Impossible trianglen"; else if (max==min) cout << "Equilateral trianglen"; else if (max==med||med==min) cout << "Isoceles trianglen"; else if (max*max==min*min + med*med) cout << "Rightangled trianglen"; else cout << "Any trianglen"; } 8 • a b c
  10. 10. Illustrative Example of Test Case Design -2 9
  11. 11. Why dynamic test techniques? • Dynamic test technique is a sampling technique. • Exhaustive testing is testing all potential inputs and conditions is unrealistic – So we need to use a subset of all potential test cases – Select the high likelihood of detecting defects • There is a required processes to select the efficient and intelligent test cases – test case design techniques are such thought processes 10
  12. 12. What is a testing technique? • a process for selecting or designing test cases based on a specification or structure model of the system • successful when detecting defects • 'best' practice • It is a process of a best test cases derived • a process of objectively evaluating the test effort Testing should be rigorous, thorough and systematic 11
  13. 13. Advantages of techniques • Different people: similar probability find faults – gain some independence of thought • Effective testing: find more faults – focus attention on specific types of fault – know you're testing the right thing • Efficient testing: find faults with less effort – avoid duplication – systematic techniques are measurable Using techniques makes testing much more effective 12
  14. 14. Measurement • Objective assessment of thoroughness of testing (with respect to use of each technique) – useful for comparison of one test effort to another • E.g. Project C 30% Boundaries partitions 40% Equivalence 70% Branches Project D 70% Branches partitions 50% Boundaries 45% Equivalence 13
  15. 15. Black Box Techniques for Test Case Design 14
  16. 16. Equivalence partitioning (EP) – primarily black box technique – divide (partition) the inputs, outputs, etc. intoareas which are the same (equivalent) – assumption: if one value works, all will work – one from each partition better than all fromone
  17. 17. 15 Equivalence Partitioning:  It is very difficult, expensive and time consuming if not at times impossible to test every single input value combination for a system.  We can break our set of test cases into sub- sets. We then choose representative values for each subset and ensure that we test these. Each subset of tests is thought of as a partition between neighbouring subsets or domains.
  18. 18.  Equivalence Partitioning:  Makes use of the principle that software acts in a general way (generalises) in the way it deals with subsets of data,  Selects Groups of inputs that will be expected to be handled in the same way.  Within a group of data, a representative input can be selected for testing.  For many professional testers this is fairly intuitive.  The approach formalises the technique allowing an intuitive approach to become repeatable.
  19. 19.  EP Example:  Consider a requirement for a software system:  “The customer is eligible for a life assurance discount if they are at least 18 and no older than 56 years of age.” For the exercise only consider integer years.
  20. 20. One of the fields on a form contains a text box which accepts numeric values in the range of 18 to 26. Identify the invalid Equivalence class. a) 17 b) 19 c) 25 d) 21
  21. 21.  In an Examination a candidate has to score minimum of 25 marks in order to pass the exam. The maximum that he can score is 50 marks. Identify the Valid Equivalence values if the student passes the exam. a) 22,24,27 b) 21,39,40 c) 29,30,31 d) 0,15,22
  22. 22. Boundary value analysis (BVA) – faults tend to lurk near boundaries – good place to look for faults – test values on both sides of boundaries
  23. 23. 17
  24. 24. A program validates a numeric field as follows: values less than 10 are rejected, values between 10 and 21 are accepted, values greater than or equal to 22 are rejected. Which of the following covers the MOST boundary values? a. 9,10,11,22 b. 9,10,21,22 c. 10,11,21,22 d. 10,11,20,21
  25. 25. In a system designed to work out the tax to be paid: An employee has £4000 of salary tax-free. The next £1500 is taxed at 10%. The next £28000 after that is taxed at 22%. Any further amount is taxed at 40%. To the nearest whole pound, which of these is a valid Boundary Value Analysis test case? a) £28000 b) £33501 c) £32001 d) £1500
  26. 26. Example 1: EP void ValveControl (int pressure, inttemperature) { if (pressure <= 10) { OpenTheValve(); printf (“Valve openedn”); } if (pressure > 100) { CloseTheValve(); printf (“Valve closedn”); } else { ShutDown(); } if (temperature > 27) { EnableCoolingCoil(); printf (“Cooling coil enabledn”); } else { • Using EP and BV, derive the set of values for pressure and temperature. • Enumerate exhaustively all the values of pressure and temperature to form a complete test suite. DisableCollingCoil(); } } 18
  27. 27. Example 2: EP & BVA • Scenario: If you take the train before 9:30 am or in the afternoon after 4:00pm until 7:30 pm (‘the rush hour’), you must pay full fare. A saver ticket is available for trains between 9:30 am and 4:00 pm. – Identify the partitions – Identify the boundary values to test train times for ticket type – Derive the test cases using EP and BVA 19
  28. 28. Example 3: EP 20
  29. 29. Valid partitions • The valid partitions can be – 0<=exam mark <=75 – 0<=coursework <=25 21
  30. 30. Invalid partitions • The most obvious partitions are – Exam mark > 75 – Exam mark < 0 – Coursework mark > 25 – Coursework mark <0 22
  31. 31. Exam mark and c/w mark 23
  32. 32. Less obvious invalid input EP • invalid INPUT EP should include 24
  33. 33. Partitions for the OUTPUTS • EP for valid OUTPUTS should include 25
  34. 34. The EP and boundaries • The EP and boundaries for total mark 26
  35. 35. Unspecified Outputs • Three unspecfied Outputs can be identified (very subjective) – Output = “E” – Output = “A+” – Output = “null” 27
  36. 36. Total EP 28
  37. 37. Test Cases corresponding to EP exam mark (INPUT) 29
  38. 38. Test Case 4-6 (coursework) 30
  39. 39. Test case for Invalid inputs 31
  40. 40. Test cases for outputs:1 32
  41. 41. Test cases for outputs:2 33
  42. 42. Test cases for invalid outputs:3 34