VectorCAST/C++Unit and Integration Testing for C and C++
- Beginning of the page
Test Solutions for C and C++
VectorCAST/C++ is an integrated software test framework that significantly reduces the time, effort, and cost associated with testing C and C++ software components necessary for validating safety and mission-critical embedded systems. VectorCAST/C++ helps efficiently create unit tests and integration tests for C and C++ code to ensure it works properly prior to release in less time and at a lower cost.
- Complete test-harness construction for unit and integration testing
- Test execution from GUI or scripts
- Code coverage analysis
- Regression Testing
- Code complexity calculation
- Automatic test creation based on decision paths
- User-defined tests for requirements-based testing
- Test execution trace and playback capabilities to debug code
- Integrations with best of breed requirements traceability tools
- Supports Agile and Test Driven Development Methods
Highlights of VectorCAST/C++
The key features of VectorCAST for C and C++ unit and integration testing include:
- Supports C++11, C++14 and C++17
- Supports a Wide Range of Compilers, Simulators, and Processor Architectures
- Eliminates Need to Build Test Drivers and Stubs Manually
- Integrated Code Coverage Capabilities, including MC/DC
- Supports Host, Simulator, or Embedded Target Testing
- Automates Regression Testing
- User Configurable Compiler Interface
- Supports DO-178 (Avionics), ISO 26262 (Automotive), IEC 61508 (Industrial), IEC 62304 (Medical), EN 50128, and EN 50657 (Rail)
- Supports Windows and Linux Platforms
- Full Command Line Interface
How it Works
Why VectorCAST/C++ for C and C++ Unit Testing?
Generally, software component testing requires at least one line of test code (in the form of stubs or mocks, drivers, and test data) for each line of C or C++ code to be tested. Manually creating these test frameworks can be expensive and inefficient because engineers need to write and debug the test code as well as the application code. With VectorCAST/C++, the mocking framework is generated automatically and component testing can be performed without writing a single line of test code, freeing time to build comprehensive test cases, debug issues and finalize the code. Writing unit tests is as easy as selecting input and expected results for the unit under test (UUT) from an easy-to-use interface. Test specific user code can also be added to the test harness. For instance, user code can be added to support teardown requirements. The mocking framework includes support for C++ mocking. Initialization test cases can be used to create objects in a C++ class, calling the class constructors to initialize objects.
Integrated Code Coverage
Without a code coverage tool, it is difficult to determine which portions of your source code have been exercised during testing. VectorCAST/C++ provides an integrated code coverage utility that allows you to gauge the effectiveness of your component testing by reporting on the source code statements or decision points exercised during individual or multiple test runs. Code coverage data can also be shared with VectorCAST/QA to produce combined coverage reports that reflect unit, integration, and system testing. Because VectorCAST/QA can also provide code coverage from your existing CPPUnit, GoogleTest or other unit testing frameworks, a complete view of code coverage across all phases of testing and all testing tools is possible. This aggregated code coverage can provide actionable insight into where testing efforts should focus. This is particularly effective when code coverage data is generated using VectorCAST/QA on legacy code, which doesn't have a formal unit test suite.
Testing is Repeatable
Since VectorCAST provides an automated C and C++ unit testing framework that doesn't have to be manually maintained, you can use it to make repeat testing more efficient. You can use your VectorCAST/C++ test project as a test runner to automatically rerun the test cases against the latest version of your C or C++ source files. These tests are easily executable against successive versions of your code. The management of test execution and the cataloging of test results are automatic. Comparing results of the same test cases against new software versions, prior to system integration is easy, with clearly outlined results, organized by date, time, unit and test names. This reporting results in fewer surprises caused by “one small change” to a software component. This is essential for companies wishing to develop software using a continuous integration and test process.
Supports Integration Testing
Multiple units can be tested in a single VectorCAST/C++ test environment. The VectorCAST/C++ unit test framework allows you to create complex test cases and scenarios that stimulate multiple functions across multiple units. Thorough integration testing is necessary for simulating real-world scenarios and ensuring proper functionality. Integration testing with VectorCAST/C++ allows dependencies to be stubbed or to be included as real code.
Data Capture and Control Flow
VectorCAST/C++ supports the use of Probe Points, which allow for run-time changes to data or control flow to support testing. This allows the test case to automatically drive the code down a hard-to-reach path. Asserts can also be used to capture the state of the code at a specific point in time. When the assert is evaluated during test execution, an event is logged in in the Execution Results report along with whether the assert was true or false. Probe points can also be used on function exit to add custom teardown code.
VectorCAST/C++ automatically compiles and links all of its generated test harness components using your compiler. An interface to your compiler’s debugger is also provided so that you can run test cases under the control of the debugger, making it easier to debug issues.
Test-Driven Development (TDD)
VectorCAST/C++ supports Agile and Test Driven Development methodologies. Once the design is complete, you can focus on test case development. This allows you to construct all unit tests based simply on the header files, prior to developing any application code. Early in this process, unit tests will fail due to the absence of source code. However, with the incremental development of code for individual units, the unit tests will begin to pass as less stubs or mocks and more real code is used. After this process, the unit test suite can be regression tested automatically.
Embedded Target Testing
VectorCAST/C++, when used in conjunction with VectorCAST RSP, allows C and C++ unit testing directly on your embedded target system. VectorCAST RSP is integrated with your specific cross compiler and RTOS, making it the perfect tool for testing real-time applications. Test cases may be developed in a host environment and then re-executed on an embedded target to verify real-world target and cross-compiler performance. This ability to compile and run the software executable in a real-world environment helps build confidence in the application.
VectorCAST/C++ is designed to work with your existing software development toolchain and build system. You can build your software using common development environments like Windows Visual Studio, cmake or Github, allowing you to work based on already established workflows. Better yet, your test projects are executable in multiple environments and VectorCAST/C++ will use the compiler, operating system, and hardware appropriate for that environment. This means you can use VectorCAST/C++ for both host-based development testing, using Visual Studio for instance, as well as testing in your final embedded hardware target environment. This provides real-world testing scenarios that ensure the best possible functionality for your software. Python scripts can also be used to integrate VectorCAST with other tools in your development environment.
Data API and Reporting
VectorCAST/C++ has a compete data API that allows you to build your own custom reports. The data API also allows advanced customization of VectorCAST via the development of Python scripts that provide advanced analysis based on the VectorCAST data. Some reports are also available in xml format including the Probe Points Report which produces a list of probe points which can be parsed and passed to a third party tool managing the probe points.
C and C++ Supported Compilers
For C and C++, VectorCAST is user-configurable for the compiler that you are using. VectorCAST has a list of hundreds of compiler templates already installed. If the compiler you are using is not on the list of supported C and C++ compilers, you simply need to configure the compile and link commands for your compiler.
News & Events
The VectorCAST Services group helps your organization implement industry-focused, best practice-based methodologies to improve software quality and productivity. What sets the VectorCAST Services group apart from other professional services groups is the expertise in complex testing environments and the focus on mentoring clients for self-sufficiency while helping them establish repeatable software testing processes.
Our workshops and tutorials provide you several opportunities to expand or deepen your knowledge about VectorCAST.
Gain a basic understanding of Unit Testing Frameworks, Continuous Integration, and Code Coverage concepts, and how the VectorCAST test automation platform can be used to implement those concepts.