The box approach:-
Software testing methods are traditionally divided into white- and black-box testing. These two approaches are used to describe the point of view that a test engineer takes when designing test cases.
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.
- Types of white box testing
- The following types of white box testing exist:
- API testing (application programming interface) – testing of the application using public and private APIs
- Code coverage – creating tests to satisfy some criteria of code coverage (e.g., the test designer can create tests to cause all statements in the program to be executed at least once)
- Fault injection methods – improving the coverage of a test by introducing faults to test code paths
- Mutation testing methods
- Static testing – White box testing includes all static testing
- Test coverage
- White box testing methods can also be used to evaluate the completeness of a test suite that was created with black box testing methods. This allows the software team to examine parts of a system that are rarely tested and ensures that the most important function points have been tested.
- Two common forms of code coverage are:
- Function coverage, which reports on functions executed
- Statement coverage, which reports on the number of lines executed to complete the test
They both return a code coverage metric, measured as a percentage.
Black box testing
Black box testing treats the software as a “black box”—without any knowledge of internal implementation. Black box testing methods include: equivalence partitioning, boundary value analysis, all-pairs testing, fuzz testing, model-based testing, exploratory testing and specification-based testing.
- Specification-based testing: Specification-based testing aims to test the functionality of software according to the applicable requirements. Thus, the tester inputs data into, and only sees the output from, the test object. This level of testing usually requires thorough test cases to be provided to the tester, who then can simply verify that for a given input, the output value (or behavior), either “is” or “is not” the same as the expected value specified in the test case.
- Specification-based testing is necessary, but it is insufficient to guard against certain risks.
- Advantages and disadvantages: The black box tester has no “bonds” with the code, and a tester’s perception is very simple: a code must have bugs. Using the principle, “Ask and you shall receive,” black box testers find bugs where programmers do not. On the other hand, black box testing has been said to be “like a walk in a dark labyrinth without a flashlight,” because the tester doesn’t know how the software being tested was actually constructed. As a result, there are situations when (1) a tester writes many test cases to check something that could have been tested by only one test case, and/or (2) some parts of the back-end are not tested at all.
Therefore, black box testing has the advantage of “an unaffiliated opinion”, on the one hand, and the disadvantage of “blind exploring”, on the other.
Grey box testing
- Grey box testing (American spelling: gray box testing) involves having knowledge of internal data structures and algorithms for purposes of designing the test cases, but testing at the user, or black-box level.
- Manipulating input data and formatting output do not qualify as grey box, because the input and output are clearly outside of the “black-box” that we are calling the system under test.
- This distinction is particularly important when conducting integration testing between two modules of code written by two different developers, where only the interfaces are exposed for test.
- However, modifying a data repository does qualify as grey box, as the user would not normally be able to change the data outside of the system under test.
- Grey box testing may also include reverse engineering to determine, for instance, boundary values or error messages.