Model-based approaches close the gap between development and testing
May 01, 2012
To bring testing on par with design, development teams are turning to model-based testing approaches for increased QA and reduced cost.
An age of smarter products is ushering in embedded product designs with increased functionality, rising complexity, and compressed delivery windows. These products often need to comply with strict development regulations for use in safety- or mission-critical applications such as aircraft, automobiles, or medical devices.
Model-based development has boosted developer productivity with graphical notations such as Unified Modeling Language (UML) and Systems Modeling Language (SysML) to help manage complexity and uncover design anomalies earlier in the development life cycle. In many cases this has left testing struggling to catch up. It is frequently the biggest time and budget item in projects, and therefore the first to be cut. Despite this, testing costs are increasing; much testing has remained rooted in manual, code-based approaches that do not easily scale to today’s demands.
The proven power of model-driven development
Using models, software engineers can more clearly understand and analyze requirements, make architectural trade-offs, define design specifications, validate and verify behavior with simulation, and generate code for direct deployment on target hardware. A key benefit of a model is that consistency and correctness are maintained across the design as it changes. With UML, each diagram can capture different views of the model at different levels of abstraction while remaining consistent across these views. The semantics of the modeling language enforce team consistency and help automate life-cycle tasks, including code generation.
Repeatable processes are the key to improving collaboration and productivity while reducing the cost of demonstrating regulatory compliance. A 2011 embedded development study by Jerry Krasner of Embedded Market Forecasters found that model-driven development reduced development time typically lost to delays by more than 40 percent, delivering typical project savings of $250,000.
Enhancing quality at every step of the life cycle
The next natural step to maximize productivity and agility is to improve the testing process. The “usual suspects” addressing this are the late detection (and resolution) of defects, as well as the communication and consistency issues between teams as changes occur and defects are detected.
Early identification of defects is critical to reduce development costs and meet time-to-market objectives. Many defects are introduced in the design during the early stages of development, but repair costs increase exponentially as defect resolution is delayed. Not only can late defect resolution harm project financial performance, a high intensity of late rework can also derail delivery schedules and delivered quality. Defect resolution must be closely linked to defect discovery, as it is typically much easier to fix a defect that has just been discovered than to attempt a repair after further changes have obscured the original cause.
Successful development projects must deliver products that address customer needs to the required level of quality. Linking unit, integration, validation, and verification tests to requirements is fundamental, and automating traceability is key to efficiently execute projects as changes occur and defects are detected.
Model-based testing and the UML Testing Profile
Model-based testing uses modeling to construct and execute the necessary artifacts to perform software testing. The UML Testing Profile extends the applicability of UML to include model-based testing. Using this profile, test architectures can be automatically created for a system from the definition of its interfaces. Test cases consistent with the latest requirements can be defined graphically using sequence diagrams, state charts, or activity diagrams, providing a common modeling language to define test inputs and expected results (see Figure 1). This approach tightens the linkage between requirements, design elements, and tests, thus facilitating better traceability that can benefit both agility and impact analysis. Test cases can be executed on the developer’s desktop and on the target, improving testing productivity.
Strengthening the bond between development and quality management
This move to model-based developer testing doesn’t directly benefit the Quality Assurance (QA) team, as QA engineers typically don’t want, nor should they be forced to become UML specialists. What is needed is a way to allow QA engineers to make use of model-based testing resources without the need to author and own them. This can be achieved through model-driven testing tools that link the tests to the QA test management environment. The tools allow tests to be executed in place from the test management tool and the results to be passed automatically to the test management repository. Tests are then managed in a single location, avoiding the inconsistencies and inefficiencies of duplication, and are available for execution at any point in the development process.
Bringing test result data back into the test management environment can automate the defect resolution process, further optimizing the development and testing process. The QA test management environment should also support linkage to requirements management tooling to ensure that tests can be linked back to specific requirements. This will facilitate test coverage automation, enabling test sets to be automatically defined against requirements or changes.
Taking a project to the next level
By implementing a model-based testing tool connected to test management, embedded development teams can take the following tangible steps to make their projects more successful while freeing up valuable time for innovation:
- Consistency: A central test repository across the development organization will improve efficiency and lead to higher quality. Rather than individual test engineers creating multiple versions of tests through error-prone, manual replication processes, tests are written once and reused as required throughout the development process. A single source of truth for tests can also aid collaboration and ultimately improve delivered quality, as tests are more available throughout the development life cycle, encouraging more frequent testing.
- Communication: Model-based test execution within the quality management environment means that QA engineers can run tests and act upon results without having to be modeling specialists. They can navigate from a failed test to the related requirements and to the source of the problem in the design mode or associated code. This can be particularly useful in distributed and offshore development environments where it can help engender collaboration and build empathy between otherwise isolated developers, testers, and quality professionals.
- Automation: Improved automation of test creation, execution, and results management will significantly reduce the cost and time of testing. This allows more testing to take place, reducing the risk of regression issues in complex projects. In the same vein, automated defect tracking/resolution connects model-based testing to quality management with a backbone of traceability from requirements through to code. This ensures developers have timely and quantitative information to fix defects, and that the effects of defects on delivered functionality are understood. As teams strive to become more agile, it is imperative to prioritize defect resolution over new functionality to avoid accumulating technical debt.
- Agility: Model-based testing conducted using the same modeling notation and tools as design activities facilitates test-driven development. Traceability from requirements to testing will be the key to quantifying results, helping answer the critical question in any project: “Are we ready to ship?”
A call to action
Model-based testing can be considered a first step to bring testing efficiency on par with model-driven development. While its immediate effects are in automating the developer testing environment (with correct linkage to the QA environment), it can enable much wider benefits (see Figure 2). By providing tool support for test execution, test version management, and results management within the QA environment, coupled with life-cycle traceability, a greater degree of test automation can be implemented, eliminating a key bottleneck in the development life cycle.
To realize these benefits, embedded development teams should:
- Extend their modeling capabilities from design to testing with tools that support the UML Testing Profile, such as IBM Rational Rhapsody.
- Ensure their modeling and test management environments are closely linked through tools, such as the IBM Rational solution for real-time and embedded software development.
- Adopt, enforce, and continually improve repeatable processes supported through development and testing tools.
In this way, teams can achieve improved collaboration, productivity, and agility, helping them deliver higher-quality products more rapidly at reduced cost.
 UML Testing Profile, OMG, June 2011: