| Cantata - "More than just a C++ unit testing tool!" |
 |
| Telecomms products are archetypal high-integrity systems: a national telephone system is just expected to work, no excuses! The problem for telecomms system developers has often been that their technology, including Client-Server architecture, intensive user-interfaces and the use of C++, is difficult to test. This case study illustrates how one world-player has used Cantata to assist its software testing, and how the product has far surpassed initial expectations in the types of testing it has been able to support. |
| Dr Keil Informationstechnik GmbH & Co KG is a leading consulting and software house specialising in services and outsourcing for large customers in southern Germany. Their client (who we are unable to name for commercial reasons) is one of the world's main suppliers of telecomms equipment. With customers all over the globe they sell to national PTTs and other network providers offering a range of services which starts with hardware components and extends to complete turnkey systems, with products covering both fixed and mobile networks. |
| One of the key elements in such huge systems is the administration module which controls access of users to the network. In 1994 it was decided that this module in the client's system needed a major revision, and so a project was established to create the new release. |
| Reliability |
| At the top of the list of customer requirements was 'Reliability, reliability, and more reliability!' The maximum downtime permitted with systems of this type is 0.5 hours per year, and this need forces the highest possible emphasis on testing. Everything from the lowest level software unit up to the fully integrated equipment, had to go through a rigorous program of testing to ensure that the necessary reliability was 'built in'. |
| In charge of software testing was Michael Zeiner (Dr Keil Informationstechnik). The system was to be implemented with Client-Server architecture and the language to be used was C++. |
| Software testing was to cover a wide spectrum of activities from the unit/class level through program and up to the subsystem and system levels. The job was further complicated by the need to test many different types of component including algorithmic functions and methods, interfaces for an OO database and GUI classes that deal with user interaction. Finally, the testing of clients and servers interacting properly with each other, under varying loads, needed to be considered. |
| The immediate job facing Zeiner was to define a set of standards for all these different tasks and to choose tools which would allow them to be carried out in an efficient way. In 1995 Cantata was selected as a possible candidate, and within six months it had proved so effective that it was adopted as the main software test tool. The key aspect of its behaviour which led Zeiner to make this decision was Cantata's versatility: although procured mainly to help with unit testing, the tool proved flexible to the point where it could be used for numerous other testing tasks. |
| Coverage was key |
| Zeiner brought with him certain lessons learnt from previous projects. The most vivid of these was that 90% of the code in any system can be tested (i.e. 90 % statement coverage) in half the available time, and then the remaining time needs to be spent chasing the last development.10% coverage. Nevertheless, in the case of finite state driven software, this last fraction of the code is involved in approximately 45% of all possible states the software under test may reach. There had been a tendency for the developers to want to stop testing at the 90% statement level ('as almost all the code is working'), but Zeiner determined that their integrity requirements demanded a much higher level of coverage. The presentation of those results by Cantata coverage reports convinced the project leaders to insist on continuing testing to reach the goals for decision coverage - 97% and Boolean coverage - 70%. The graph below shows how coverage on one of the components reached the required levels over a period of two weeks during February this year. |
 |
| Cross Connection (Workstation Application) |
| From Unit to Cluster Test |
| Having used Cantata to test code at the class level, there arose the need to start testing at a more functional level. The problem of stubbing C++ classes was a severe one, and this affected all types of component, whether algorithmic or those providing user or database interfaces. So the team looked for a way of getting both the benefit of test depth, as with "classic" isolation testing, and of testing the special features of OO code (derivation, containment, messages, notifications, etc.). |
| The solution was to define clusters of typically 2 - 10 classes and objects that could be seen as functionally coherent , i.e. working on the same functional task. These clusters could then be tested independently of other clusters. By sensible selection of objects to go into each cluster it was possible to make the number of stubs required perfectly manageable. Through implementing intelligent interfaces to these stubs it was even possible to test other cluster objects and so quite a few errors were discovered without any additional effort. |
| GUI and Database objects |
| Apart from testing the traditional algorithmic objects Cantata proved surprisingly versatile in helping check graphical user interface components and database objects. This was done by sending, receiving and checking messages and notifications all from within the Cantata test scripts. A similar method has also been used for testing at the Client/Server level: tests were written to test both the server and the client with test scripts used to simulate the other party. Using this technique it was possible to test the server under load from several simulated clients with scripts behaving as the clients. Client testing was described by Zeiner, "The client felt like it was being served by its real server. The test cases came from the specification of the functionality of the server." An added benefit came from the chance to carry out load and performance tests as well: "Without using Cantata scripts we would have had to use more than one tool, or much more work would have been necessary, or probably both." |
| Summary |
| The project has so far generated about 200K lines of code. Zeiner is enthusiastic about the use of Cantata: "Using this approach we have improved from three days for the detection and correction of each error, down to one day. This includes the time for identifying the error, making the relevant changes to the code, and rerunning the low level tests. We have benefited greatly from being able to employ test case reuse. Even more productivity can be expected in future with Cantata as there will be no effort for learning and implementing the methodology." |
| The project is now actively participating in the beta trial of Cantata++ which will considerably lessen the burden of stubbing C++. |
| IPL would like to thank Dr Keil Informationstechnik for permission to report on their experiences with Cantata, and take this opportunity to wish them well with their current and future projects. |