Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Black Box Testing

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 11

Amaan & Ajay

Black Box Testing

18102044 & 18101025


Black and white box testing
What is the difference between black- and white-box testing?

• black-box (procedural) test: Written without knowledge of how


the class under test is implemented.
– focuses on input/output of each component or call

• white-box (structural) test: Written with knowledge of the


implementation of the code under test.
– focuses on internal states of objects and code
– focuses on trying to cover all code paths/statements
– requires internal knowledge of the component to craft input
• example: knowing that the internal data structure for a spreadsheet uses
256 rows/columns, test with 255 or 257
2
Black-box testing
• black-box is based on requirements and functionality, not code

• tester may have actually seen the code before ("gray box")
– but doesn't look at it while constructing the tests

• often done from the end user or OO client's perspective

• emphasis on parameters, inputs/outputs (and their validity)

3
Types of black-box
• requirements based
• positive/negative - checks both good/bad results
• boundary value analysis
• decision tables
• equivalence partitioning - group related inputs/outputs
• state-based - based on object state diagrams
• compatibility testing
• user documentation testing
• domain testing

4
bbt

5
Boundary testing
• boundary value analysis: Testing conditions on bounds
between classes of inputs.

• Why is it useful to test near boundaries?

– likely source of programmer errors (< vs. <=, etc.)


– language has many ways to implement boundary checking
– requirement specs may be fuzzy about behavior on boundaries
– often uncovers internal hidden limits in code
• example: array list must resize its internal array when it fills capacity

6
Boundary example
• Imagine we are testing a Date class with a
daysInMonth(month, year) method.
– What are some conditions and boundary tests for this method?

• Possible answers:
– check for leap years (every 4th yr, no 100s, yes 400s)
– try years such as: even 100s, 101s, 4s, 5s
– try months such as: June, July, Feb, invalid values

7
Equivalence testing
• equivalence partitioning:
– A black-box test technique to reduce # of required test cases.

– steps in equivalence testing:


• identify classes of inputs with same behavior
• test on at least one member of each equivalence class
• assume behavior will be same for all members of class

– criteria for selecting equivalence classes:


• coverage : every input is in one class
• disjointedness : no input in more than one class
• representation : if error with 1 member of class, will occur with all

8
Example
• Suppose our spec says that the code accepts between
4 and 24 inputs, and each one is a 3-digit positive
integer
• One dimension: partition the number of inputs
– Classes are “x<4”, “4<=x<=24”, “24<x”
– Chosen values: 3,4,5, 14, 23,24,25
• Another dimension: partition the integer values
– Classes are “x<100”, “100<=x<=999”, “999<x”
– Chosen values: 99,100,101, 500, 998,999,1000

9
Example.2
• Similar approach can be used for the output: exercise
boundary values
• Suppose that the spec says “the output is between 3
and 6 integers, each one in the range 1000-2500
• Try to design input that produces
– 3 outputs with value 1000
– 3 outputs with value 2500
– 6 outputs with value 1000
– 6 outputs with value 2500

10
Scope and Focus
• Unit testing: scope = individual component
– Focus: component correctness
– Black-box and white-box techniques
• Integration testing: scope = set of interacting
components
– Focus: correctness of component interactions
– Mostly black-box, some white-box techniques
• System testing: scope = entire system
– Focus: overall system correctness
– Only black-box techniques

11

You might also like