When unit testing, often a developer has to contrive complicated tests in order to test a private method or discover the contents of a private variable. This often results in the test code becoming cluttered, and makes the tests less intuitive and more prone to errors. By using the capabilities of a debugger to inspect and test private methods and variables, it is possible to remove the need for complicated unit testing suites, and instead integrate the automated execution of unit tests within functional verification and system verification test suites. This is combinational testing.
InspectionTesting Using Debugging Capabilities To Allow Combinational Testing
Disclosed is a mechanism for being able to use debugger capabilities, in order to inspect and hence test, private variables. In doing so, it is possible to test private methods by inspecting their return values, and any members they effect, as they are being called during code execution. The advantage of this idea is that it can be applied to existing code bases, without requiring any change to the executable code. Additionally, using this method of inspection testing can greatly reduce the size of test suites, which can contain a lot of unnecessary code in order to perform set-up, execute a method that will use the private method, then clean up after. It also allows the tester to focus solely on the correctness of the private method, without the risk that any calling methods might inject errors.
The key advantage of this form of testing is that it can run whilst other forms of testing are running, such as function verification and system verification testing, as there is no need for additional test code to be running. This provides extra test coverage and can dramatically reduce the time taken to diagnose functional test failures, as unit test failures can be evaluated first. Additionally, if a functional test fails without a unit test failing then this could indicate that further unit tests are required.
This mechanism works by using the debug facilities of the chosen language/operating system to do assertions on private variables and methods. Source code can be marked up with assertions, and then executed through a run-time which launches it in d...