Black Box Testing is one of the software testing methods that checks the functionality of the application on the basis of the specifications available.
Basically in this type of testing the internal structure/design/ implementation of the item that is tested is not known to the tester. Black box testing is also known as Specification-based testing, Behavioral testing, Opaque box testing, Closed box testing, and Eye to eye testing. This method of testing is applicable to every level of software testing.
Let’s take an example of a login screen of an application. The login screen has two fields, username, and password. Since it’s a black box testing it will not take the specifications of the code into consideration, so it will test the username and password to login to the account.
STEPS TO INITIATE BLACK BOX TESTING
- Understand the requirement specifications of the application
This can be done through the help of SRS documents
- Call for the evaluation of the valid inputs and test scenarios
- Prepare the test cases
- Execute the test cases to generate the output
- The steps which tend to fail are marked and sent to the development team to fix them
- Retest the system to ensure that the defect fix works fine and there are no more defects
TYPES OF BLACK BOX TESTING
There are three types of Black Box Testing and they are mentioned below:
- Functional Testing
Black box testing tests specific functions of the software during the process of testing. Functional testing focuses on the most critical aspects of the software and on integration between key components.
- Non-Functional Testing
Black box testing is not only used to check features and functionality, it can go beyond and check the additional aspects of the software.
A Non-Functional test checks whether the software can perform a specific action or not rather than it checks “how” it performs that action.
- Regression Testing
Black box testing is helpful in checking whether a new version of the software exhibits any defects from one version to the next. Regression testing can be applied to both functional and non-functional aspects of the software.
TOOLS FOR BLACK BOX TESTING
For Functional and Regression testing
- UFT – it is a product from Micro Focus( Formerly HP) and it stands for Unified Functional Test. It helps the tester to perform an automated test without monitoring once the development of the script is completed. It compares the results and reports in the executive summary.
- Selenium – it is an open-source UI automation test suite. It can be easily deployed on platforms such as Macintosh, Windows, Linux, and much more.
For Non-Functional Testing
- LoadRunner – is a product of MicroFocus. It is used to test applications and measure the system behavior. It also analyzes the performance of key components of the application.
- JMeter – is a testing tool that is used for analyzing and measuring the performance of the applications. It has a friendly GUI and it is platform-independent. It can also be integrated with Selenium.
LEVELS APPLICABLE TO BLACK BOX TESTING
Black box testing is applicable to the following levels
- Integration Testing: It is a level of software testing where individual units are combined and tested as a group. The purpose is to expose faults between integrated units. It is the second level of testing performed after unit testing and before system testing.
- System Testing: Level of software testing where an integrated software is tested. The purpose is to evaluate the system’s compliance. It is the third level of testing performed after integration testing and before acceptance testing.
- Acceptance Testing: Level of software testing where a system is tested for acceptability. The main purpose is to evaluate the system’s compliance with business requirements. Acceptance Testing is the last level of software testing performed after System Testing.
BLACK BOX TESTING TECHNIQUES
These are the Black box testing techniques:
- Boundary Value Analysis
- Equivalence Partitioning
- Decision Table Testing
- State Transition Testing
- Error Guessing
Let’s discuss them in detail.
- Boundary Value Analysis: This technique identifies the flaws of the input values rather than focusing on the range of input values. It also helps in dealing with extreme output values. It is also helpful while you are performing equivalence partitioning.
|Works well with variables|
Less costly in creating tests
Can be used at all levels of testing
|Generates a high number of test cases|
Can’t be used for boolean variables
Can’t be used for logical variables
Not useful for strong languages
- Equivalence Partitioning: This technique is mostly used to write test cases. In this, you divide the test cases into different parts that are considered to be the same. It can be applied to all levels of testing like unit, integration, system. For example: If you are testing for an input box that is accepting numbers from 1 to 50 then there is no use in writing 100 test cases for all 100 valid input numbers. So by using the Equivalence Partitioning method the test cases can be divided into four sets of input data called classes.
In the above example, you can divide the test cases into four equivalence classes of some valid and invalid inputs.
|Provides complete testing|
Enables large domains of inputs and outputs
Avoids test redundancy
|Can’t handle boundary value errors|
- Decision Table Testing: When you have to test system behavior for different combinations then the software testing technique one uses is decision table testing. It is a systematic approach where different inputs and the system behavior are registered in a tabular form. This is also called the Cause-effect table.
For example: below is the flow diagram of a business login screen.
- The first step is to name all the branches and leaves.
- a,b,c are the branches whereas 1,2,3 are leaves.
|Tools provide complete coverage of test cases|
It works iteratively
It has a completeness
|If the number of inputs increases the table turns out to be a bit more complicated|
State Transition Testing
State transition testing is a technique of black-box testing where the tests are designed to execute valid and invalid state transitions.
It shows how the system changes on certain inputs. It has four main components:
- Change mode: When activated, display mode moves from time to date.
- Time set: When activated, display mode changes from alter time to time
- Date set: When activated, display mode changes from altering date to date
- Reset: When the display mode is time or date it sets them to alter time or alter the date
|Enables the testers to cover invalid states|
Gives a proper representation of system behavior
It covers all the conditions
|It cannot be performed everywhere|
It is not reliable
Error Guessing: This type of testing technique can only be learned if you are experienced. In this technique, the analyst uses their experience to guess the problems within the application.
For example: If an analyst finds errors in a login page, then the testers will write the test cases focusing on the login page.
|Compliments other testing approaches|
It makes testing much more effective and efficient
It quickly exposes the defects
|One requires testing experience|
Relies on testers’ intuition
PROS AND CONS OF BLACK BOX TESTING
|Efficient when used on large systems.|
Testers can be from a non-technical background.
The test is done from the user’s point of view.
Testing helps you identify contradictions.
Test cases can be designed once the functional specifications are laid out.
Testing is balanced and unprejudiced.
|Test cases are not easy to design without having functional specifications.|
Heavy chances of having unidentified paths during the testing process.
Writing test cases is slow and difficult.
Which is better Black Box Testing or White Box Testing?
For that, you need to know a little about white box testing
WHITE BOX TESTING
It is a software testing method in which the structure/design/implementation of the item is known to the tester. The tester chooses inputs and determines the appropriate outputs.
Other names for white box testing are glass box testing, clear box testing, structural testing.
INPUT A & B C = A + B IF C>100 PRINT “ITS DONE"
- First, assign the value of A and B. suppose A=60 and B=50.
- Second, now C is assigned the value of A+B, A=60, B=50 hence C=110.
- Third, we will check if C>100 and in this case it is true hence we will get the result ITS DONE.
STEPS TO INITIATE WHITE BOX TESTING
- Identify the feature to be tested.
- Plot all paths in the flowgraph.
- Identify all possible paths for the flowgraph.
- Write test cases for each graph.
- Execute, rinse, and repeat.
WHITE BOX TESTING TECHNIQUES
- Statement coverage: It ensures whether each line is executed at least once.
- Branch coverage: It ensures that every branch from each decision point is executed.
- Path coverage: It ensures that every path is traversed at least once.
TYPES OF WHITE BOX TESTING
There are three types of White Box Testing and they are mentioned below:
- Unit Testing
- White Box Penetration Testing
- Testing for memory leaks
- White box mutation testing
TOOLS FOR WHITE BOX TESTING
- CppUnit: CppUnit is a part of JsuNit. The tool can give output in the form of plain text or in XML format but it totally depends on the coder how he wants it.
- Veracode: It is proprietary software and it is used to test some powerful languages like .NET, C++, JAVA, and much more.
PROS AND CONS OF WHITE BOX TESTING
|Let the tester know when the testing is done.|
Techniques are relatively easy to automate.
Optimization becomes easy for the programmer.
It is a bit easy to remove the part of the code that is not needed for the functionality of the program.
|It is relatively costlier.|
Not possible to test each condition of the code.
Can’t find the missing functionality of the program.
DIFFERENCE BETWEEN WHITE BOX AND BLACK BOX TESTING
|Basis||Black Box Testing||White Box Testing|
|DEFINITION||Used to test the software without the knowledge of internal structure.||The internal structure of the software is known to the tester.|
|OTHER NAMES||Specification-based testing, Behavioral testing, Opaque box testing, Closed box testing, and Eye to eye testing.||glass box testing, clear box testing, structural testing.|
|BASE OF TESTING||Testing is based on external expectations.||Internal working is known to the coder.|
|USAGE||Suited for a high level of testing.||Suited for the low level of testing.|
|PROGRAMMING LANGUAGE||No need for a programming language.||The programming language is required.|
|IMPLEMENTATION KNOWLEDGE||Not required in black box testing.||A complete understanding of implementation is required.|
|AUTOMATION||Difficult to automate.||Easy to automate.|
|OBJECTIVE||The objective is to check the functionality of the system||The objective is to check the quality of the code.|
|TESTED BY||Performed by the tester, end-user.||Usually done by the tester and developers.|
|GRANULARITY||Granularity is low.||Granularity is high.|
|TESTING METHOD||Based on trial and error methods.||Internal boundaries can be tested.|
|TIME||Less time-consuming.||More time-consuming.|
|CODE ACCESS||Code access is not required||Code access is required.|
Both Black Box Testing and White Box Testing are necessary and complement each other. White box testing assures code functionality and high level of testing whereas black box testing enhances end-user experiences. As a tester one should have a good knowledge of black box testing so that you can do proper testing.
Read this article to understand more about Software Testing