What is Black Box ,White Box and Gray Box Testing in Software Testing ? Advantages, Disadvantages, Error Guessing.
What is Black Box Testing and White Box Testing ?
BLACK BOX TESTING
Black box testing is testing that ignores the internal mechanism of a system or component and focuses solely on the outputs generated in response to selected inputs and execution conditions.
(also called as Behavioral testing, Functional testing, Data driven testing, I/O driven testing)
- Approach to the testing where program is considered as a "black box".
- The system is considered as a black box where the outputs of the test results are matched against user Specifications.
- Inputs are given and outputs are compared against specifications.
- No implementation details of the code are considered.
- Test cases are based on requirement specifications.
- Equivalence Class partitioning method
- Boundary value analysis
- Decision Tables
- State transition testing
- Use case based testing
- Error guessing
Equivalence Partitioning :
- Equivalence partitioning is a black-box testing method.
- Divide the input domain of a program into classes of data.
- Derive test cases based on these partitions.
- An equivalence class represents a set of valid or invalid states for input condition.
Boundary Value Analysis :
- Many system have tendency to fail on boundary. So testing boundary values of application is important.
- Boundary Value Analysis (BVA) is a test Functional Testing technique where the extreme boundary values are chosen.
- Boundary values include maximum, minimum, just inside/outside boundaries, typical values, and error values.
- Extends equivalence partitioning, Test both sides of each boundary.
Min-1, Min, Min+1, Nom, Max-1, Max, Max+1
Decision Tables
- Explore combinations of inputs, situations or events.
- It is very easy to overlook specific combinations of input.
- Start by expressing the input conditions of interest so that they are either True or False.
State Transition Testing :
- Process of writing the test cases for each and every possible look where application or system is changing the state from one state to another state.
- It is used when there is a sequence of events and associated conditions that apply to those events.
So, testing with the correct password and with an incorrect password is compulsory, for that we use state transition testing.
Use Case Based Testing :
Actors represented with help of stick diagram and use cases are represented with help of ellipse.
U.C Description Login can authorize users
Actors User of the application
Related U.C User Registration
Preconditions Users must have registered and be given a valid login
Primary Scenario 1. View home page
2. Enter user id and password
3. Validate user login
3.1 [if valid] Allow further access
3.2 [if invalid] Deny access
Alternative Scenario None
Post Conditions Application allows valid users further transaction
UI Mock Up A model user screen
Special Requirements None
Error Guessing :
Tester guesses from his/her experience on the error-prone area and concentrates around that area.
Example : When the bike stops, first thing you do is - check the petrol. You probably wont go to mechanic or read the manual or check the spark plug you know from your experience or usage that petrol could be over.
Advantages of Black Box Testing :
- More effective on larger units of code than glass box testing.
- Testers and developers are independent of each other.
- Tester needs no knowledge of code in which system is designed.
- Testing is done from a user's point of view.
- Test cases can be designed as soon as specifications are complete.
Disadvantage of Black Box Testing :
- Only a small number of possible inputs can actually be tested.
- Without clear and concise specifications, test cases are hard to design.
- Repetition of test inputs if tester is not informed of the test cases the programmer has already tried.
- May leave many program paths untested.
White Box Testing
White box testing is testing that takes into account the internal mechanism of a system or component. Also called as Structural testing, Glass box testing, Transparent-box and clear box Testing.
- Contrary to black box testing.
- Testing based on analysis of internal logic (design, code, etc.).
- White-box testing techniques apply primarily to lower levels of testing (e.g. unit and component).
- Targets to check control flow looping, dataflow, all the nodes and paths.
- Mandatory to have a knowledge of code in which the system is designed.
White Box testing techniques :-
- Statement Coverage
- Decision Coverage
- Condition Coverage
Statement Coverage :
- Execute all the statements at least once.
- Weakest form of coverage as it requires every line of code to be checked.
Decision Coverage (Branch Coverage) :
- Exercise all logical decision on their true or false sides.
- To test the branch we must once.
- Check the true condition and once the false condition.
Condition Coverage :
- Execute each decision with all possible outcomes at least once.
- It requires all cases.
- Checks each of the ways condition can be made true or false.
Cyclomatic Complexity :
It is important to testers because it provides an indication of the amount of testing.
Cyclomatic complexity is defined as :
control flow graph G,
cyclomatic complexity V(G):
V(G)=E-N+2where
N is the number of nodes in G
E is the number of edges in G
Read A
IF A<0 THEN
Print "A negative"
ENDIF
IF A>0THEN
Print "A positive"
ENDIF
Cyclomatic complexity=3
E-N+2
8-7+2=3
Advantages of White Box Testing :
- As the knowledge of internal coding structure is pre-requisite, it becomes very easy to find out which type of input/data can help in testing the application effectively.
- It helps in optimizing the code.
- Helps in removing the extra lines of code, which can bring in hidden defects.
Disadvantages of White Box Testing :
- As the knowledge of internal coding structure is pre-requisite, a skilled tester is needed. So cost increases.
- It is impossible to look into every bit of code to find out hidden errors, which may create problems, resulting in failure of an application.
- It fails to detect missing functions.
Gray Box Testing
- Gray Box Testing is a combination of Black Box Testing method and White Box Testing method.
- The internal structure is partially known.
- This involves having access to internal data structures and algorithms for purposes of designing the test cases, but testing at the user, or black-box level.
- Gray Box Testing is named so because the software program, in the eyes of the tester is like a gray/ semi-transparent box; inside which one can partially see.
Comments
Post a Comment
Please do not enter any spam link in the comment box.