logo logo

Gray Box Testing – The New Normal?

Gray Box Testing – The New Normal?

We all are familiar with black box and white box testing and have spent years doing them. Both of these approaches have their own shares of merits and demerits, and testers have learned to live with those.

Since everything is changing so fast in the technical world, gray box testing now has a center place due to merits of both approaches, and the removal of most of their demerits. In this blog, I will walk you through all you need to know about this type of testing.

So what is gray box testing?

It is a perfect cocktail made by mixing the advantages of the white box & black box testing 🍸 The tester not only tests the functional flows as if doing black box testing, but also has a partial understanding of the SUT (System Under Test).

While it keeps the basics of black box testing intact, the tester also develops a partial workable knowledge of the underlying code and architecture. Hence it is called “gray box” as the approach is between black & white box testing. It presents the system as a semi-transparent (gray) box through which they can partially see into its inner workings.

Gray box testing is a good way of finding security flaws in programs. It can assist in discovering bugs or exploits due to incorrect code structure or incorrect use of applications.

A gray box tester takes the code-targeted approach of white box testing and merges it with the various approaches of black box testing, like functional testing and regression testing. The tester assesses both the software’s internal workings and its user interface.

Gray box testing

Source: https://testinggenez.com/what-is-grey-box-testing/

An example showcasing the gray box testing

The tester has a hyperlink to test. The table below summarizes the three types of testing and the steps taken:

An example showcasing the gray box testing

How gray box testing is performed

Here, the test cases are designed while keeping in mind the application architecture and understanding of its behavior in different situations. Following is a brief summary of the steps to be carried out:

  1. Collect inputs from white box and black box testing approaches.
  2. Identify the outputs from the inputs in step 1.
  3. Identify all user journeys that convert these inputs into outputs.
  4. Identify the sub-functions for taking testing one level deep.
  5. Identify the inputs for sub-functions.
  6. Identify expected output for inputs in step 5.
  7. Execute test cases for sub-functions.
  8. Verify the result correctness of step 7 execution.
  9. Repeat steps 4-8 for each sub-function.

Testing techniques

There are 4 key testing techniques that classify as gray box testing:

  1. Matrix testing – Testing of variables in the system. The variables carry the data throughout the application. Business risk is identified for each variable and then it is examined against each risk. This helps to identify unused or under-utilized variables.
  2. Regression testing – The standard testing to see whether any new fix doesn’t break the existing application.
  3. Pattern testing – Discover patterns that cause errors. The focus here is to identify factors that led to the defect, how it was discovered and whether it should be fixed or not. This information helps in developing gray tests that ensure the patterns identified in older versions can be detected early in newer versions.
  4. Orthogonal array testing – Statistical method to perform tests. It is used when inputs are too low but the tests are complex. This helps in increasing code coverage.

✅ Advantages of gray box testing 

  1. Testing is done from both user and developer perspectives, as it combines black and white box testing.
  2. It is unbiased as it stops the disagreements between developers and testers.
  3. Better tests are created as the tester has a reasonable understanding of the code.
  4. The quality of the software gets improved.
  5. This technique focuses more on user perception.
  6. Developers are benefitted as they get enough time for bug fixing.
  7. Gray box testers do not require having high programming knowledge for testing the product.
  8. This testing technique is effective in integration testing.
  9. Complex applications and scenarios can be tested effectively with this technique.
  10. This testing technique is non-intrusive.

❌ Disadvantages of gray box testing 

  1. Complete code knowledge is not attained, hence it is difficult to achieve full code coverage.
  2. Tests may become redundant as few may be already executed by developers as part of unit testing.
  3. Some user journeys may be completely missed as the tests may not run on all input streams.
  4. It is very difficult to build the systems that are distributed across the globe.

A comparative study of the three approaches

A comparative study of the three approaches

Conclusion

The gray box technique is a powerful one to ensure the software developed is safe, secure, and reliable. It tests functional aspects from UI as well as code levels. It also offers a common approach to testing as it combines the best of white and black box testing.

What are your thoughts on the gray box technique? Let me know and feel free to add any advantages & disadvantages ✨

Vipin Jain

About the author

Vipin Jain

Vipin Jain has got 20 year experience in the IT industry. A Masters in Computer Applications from Rajasthan University in 1998, he has accumulated a deep knowledge in software projects, their methodologies and quality. He has dedicated the last 16 years of his professional career to Software Quality. Currently working with Metacube Software as Head QA and delivery manager, he is involved in establishing QCE at his company. An avid Speaker and writer, he loves speaking at conferences and delivered many presentations at national and international levels. He is member of Review Committees of various international organizations. He has presented papers in many of the best QA conferences across the world including TestingUnited, ExpoQA, QA&test and SQA, TestCon, TestingUY to name a few. Many of his papers got published in various magazines and journals across the world. He has a proven record of implementing and refining test processes for various clients across the globe.

Join TestProject Community

Get full access to the world's first cloud-based, open source friendly testing community. Enjoy TestProject's end-to-end test automation Platform, Forum, Blog and Docs - All for FREE.

Join Us Now  

Leave a Reply

popup image

Test, Deploy & Debug in < 1 hr

Leverage a cross platform open source automation framework for web & mobile testing using any language you prefer, and benefit from built-in dashboards & reports. Free & open source.
Get Started
FacebookLinkedInTwitterEmail