Difference among Black Box, White Box and Grey Box Testing

MCopper
3 min readDec 2, 2018

--

Box Approach

Software testing is an activity to check whether the actual results match the expected results and to ensure that the software system is defect free. Testing is important because software bugs can potentially cause huge monetary and human loss. For example, “In April of 1999, a software bug caused the failure of a $1.2 billion military satellite launch, the costliest accident in history”. Thus, it is very necessary to learn basics about software testing. In this blog post, we will introduce the box approach to describe the point of view that a test engineer takes when designing test cases.

Black Box Testing

Black box testing treats the software as a “black box” — without any knowledge of internal implementation. Black box testing can be regarded as an opaque and closed box. “Opaque” means we know nothing about its inside, and “closed” means we do not have the access to modify the source codes.

😀Advantages:

1. Simplicity: Testers focus on input and output without the necessity to know how the system works internally, so such tests are easy to make.

2. Rapidity: The preparation time of these tests is very short.

3. Impartiality: “an unaffiliated opinion”, i.e. the test results are neutral when doing tests from the perspective of users instead of developers.

😩 Disadvantages: “blind exploring”

1. Superficiality: The tests cannot show which parts of the codes lead to a potential problem. Some parts of the back-end may be not tested at all.

2. Redundancy: A tester writes many test cases to check something that could have been tested by only one test case.

White Box Testing

White Box testing is when the tester has access to the internal data structures and algorithms including the code that implement these. Since a tester can not only see the source codes but also manipulate the codes as part of testing process. Thus, white box testing can be regarded as a clear and open box, i.e. a box whose inside can be seen and can also be changed.

😀Advantages:

1. Anticipation: Doing these tests during a program’s development allows to spot blocking points that could turn into errors or issues in the future.

2. Optimization: With the access to change the codes, a tester could modify the codes for optimization and better performances.

3. Exhaustiveness: A tester could fully review the codes and is able to spot bugs and vulnerabilities that might be hidden on purpose.

😩 Disadvantages:

1. Complexity: The tests demand competence in programming and strong knowledge of the system being tested.

2. Duration: The length of the source codes can make these tests last for a long time.

3. Automation: Tools needed to make these tests, such as code analyzers, debuggers, etc, can have a negative impact on the system’s performances or even impact the results of the tests.

4. Scalability: Since the source code of a program is often very long, it is hard to find out what is tested and what can be put aside. Thus, a tester cannot always test everything.

5. Intrusion: White box testing is very intrusive, so there exists the possibility that testers make the codes available to another person who is external to the company. Thus, there are risks of breakage.

Grey Box Testing

Grey box testing is the combination of black box testing and white box testing. It can be regarded as a clear and closed box because a tester know the details in the codes but do not have the access to change them. Obviously, grey box testing mainly combines advantages from white box and black box testing. Here we want to emphasize two big benefits of this testing method.

😀Advantages:

1. Impartiality: This testing method involves testing at the user or black-box level.

2. Intelligence: By knowing the internal structure of the program, a tester can create more varied and smart scenarios which helps test coverage to some extent.

😩 Disadvantages:

1. Non exhaustiveness: Since the sources codes are not accessible, the tests cannot provide a complete coverage of the program.

· Sources:

1. Introduction, Basics & Importance — Guru99 module on software testing basics.

2. Introduction to Software Engineering/Testing — Wiki book that introduces the different types of software testing.

3. Black box, grey box, white box testing: what differences?

--

--