This document begins by introducing you to C++test, and then provides lessons on how to use C++test to perform static analysis, unit testing, and runtime error detection on a sample application.
Prerequisites
For all lessons:
• One of the supported compilers must be installed on a supported platform.
Some lessons have additional prerequisites, which are explained at the beginning of the lesson.
Sample ATM Application
The lessons in this tutorial demonstrate how to test the code for a sample ATM application. This application is a very simple model of an Automated Teller Machine. It allows access to bank accounts in order to deposit/withdraw funds and check balances.
The ATM application includes the following files:
- Account.[hc]xx - Models a client account
- Bank.[hc]xx - Models a bank containing a set of accounts
- BaseDisplay.[hc]xx - Defines a simplistic user interface and provides a generic implementation
- ATM.[hc]xx - Client interface to ATM
The UML model of the application’s design is as follows:
The master source for the ATM project is located in <C++test install directory>/Examples/ATM. This directory contains source files, a Makefile (using GNU gcc), and prepared Visual C++ projects. We will demonstrate how to create a C++test project for this source code in Tutorial - Creating a C++test Project.
The following image is the general view of the C++test standalone version. The standalone version and the Eclipse plugin version both have the same layout. Project files are displayed in the left pane. The right pane contains the editor. There are several tabs or views on the lower third of the screen; these tabs display information specifically related to each of the labeled tabs. The Navigator (a.k.a. "the project tree") is where you can view projects and select the resource(s) that you want to test. C++test GUI
C++test allows you to configure the default layout of the user interface. This is achieved using perspectives and views. Exercise 1: Configuring and Customizing Perspectives and Views
To customize which "views" are available:
- If the Quality Tasks view is not already open, open it by choosing Parasoft> Show View> Quality Tasks.
- To open the Coverage view, choose Parasoft> Show View> Coverage.