We evaluated many embedded software testing tools during this process. We chose VectorCAST for its robust features and ease of...Read full story »
Whether you are doing traditional waterfall development or following a test-driven development approach, unit and integration testing should be a key piece of your testing strategy. Unit testing is the process of verifying the behavior of a small and isolated unit of code, such as a single C++ class, C function, or Ada package. This is typically done prior to full system testing. Unit and integration testing are an important part of building a robust and error free application, because it allows the tester to more easily stimulate the low-level functionality of the application, and prove that the low-level requirements have been implemented properly.
The VectorCAST suite of tools for unit and integration testing is available for C and C++ (VectorCAST/C++) and Ada (VectorCAST/Ada). Both tools automate key activities associated with unit and integration testing. This includes the generation of a complete executable test harness, the management of test cases and test results, and the automation of regression testing.
Two Goals for Your Unit and Integration Testing
- Prove application correctness - this requires test cases consisting of known inputs and expected values, to stimulate the functionality of the code under test.
- Prove testing has been thorough - this requires tracking code coverage to prove that tests have executed 100% of the application code.
VectorCAST/C++ and VectorCAST/Ada automate both of these tasks and allow for the completely automatic regression testing of your application, over the entire application lifecycle.
Traditional Unit and Integration Test Process
With traditional unit testing, as each software unit is coded the developer will generate test cases to stimulate the code and run those tests to prove correctness. One danger with this work-flow is that the developer is influenced by the underlying implementation of the code when they design test cases. This can result in tests that simply test what the code was written to do, rather than what the code was intended to do.
Test Driven Development (TDD) and Agile Process
Test Driven Development (TDD) aims to solve this problem by moving test case development earlier in the process to a point after the design is completed, but before the code is written. This allows developers to build the unit tests based on the low-level requirements, and the defined interface for the unit. As each function interface is defined, new tests are added for that function. These will initially fail because no logic has been defined for the function. However, as new application code is created, the tests will start to pass. This approach requires short development, build, and test cycles and automated regression testing. VectorCAST/C++ supports this testing approach by allowing tests to be built as soon as a single header file exists.
Why is Unit and Integration Testing so Hard?
To create a suite of tests that achieves code coverage close to 100% requires generating one line of test code (drivers, stubs, and test data) for each line of application code to be tested. When unit testing is done without tools one of the challenges is keeping the unit test code up-to-date with the application code. Test software not only has to be written but also has to be debugged to ensure that it performs as expected.The necessity to create and maintain the test software is the main reason manual unit testing is so expensive and inefficient. With VectorCAST, unit testing can be performed without writing any test code.
Optimize Your Unit and Integration Testing Process Today
Learn more about VectorCAST solutions for Ada, C, and C++ unit testing today. You can evaluate a fully-functional version of the VectorCAST tools in your exact testing environment by requesting your 30 day free trial.