Vcast Quick Start PDF
Vcast Quick Start PDF
Version 6.4
New editions of this guide incorporate all material added or changed since the previous edition.
Update packages may be used between editions. The manual printing date changes when a new
edition is printed. The contents and format of this manual are subject to change without notice.
Rev: cb0043d
© Copyright 2017, Vector Software, Inc. All rights reserved. No part of the material protected by
this copyright notice may be reproduced or utilized in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any informational storage and retrieval
system, without written permission from the copyright owner.
This computer software and related documentation are provided with Restricted Rights. Use,
duplication or disclosure by the Government is subject to restrictions as set forth in the
governing Rights in Technical Data and Computer Software clause of
Vector Software reserves the right to make changes in specifications and other information
contained in this document without prior notice. Contact Vector Software to determine whether
such changes have been made.
2
Table of Contents
INTRODUCTION 5
VectorCAST Overview 6
Starting VectorCAST 6
VectorCAST Interface 7
Using the VectorCAST Examples 9
3
INDEX 41
4
Introduction
VECTORCAST OVERVIEW 6
VectorCAST Overview
VectorCAST® is a suite of test automation tools:
l VectorCAST/C++™ and VectorCAST/Ada™ automate the unit and integration testing of C, C++,
and Ada code, allowing you to easily test any subset of files (or packages for Ada) in isolation from
the rest of the application.
l VectorCAST/QA™ automates the system testing of any application, and includes code coverage
analysis for C, C++, and Ada source code.
l VectorCAST/Manage is a test automation platform that allows your team to collaborate on testing.
It provides a single point of control for test creation, execution, and reporting.
l VectorCAST/Analytics collects source code and test metrics and publishes that data via a web-
based dashboard, enabling you to identify trends in a single codebase or compare metrics between
multiple codebases.
For more detailed information about VectorCAST product features, please refer to the Interactive
Tutorials and to the User Guides for VectorCAST/C++, VectorCAST/Ada, VectorCAST/Manage and
VectorCAST/QA.
Starting VectorCAST
Before you start: Ensure that VectorCAST is installed and that the environment variable
VECTORCAST_DIR is set to the installation directory. Refer to the Interactive Tutorials for detailed
installation instructions.
UNIX
In UNIX or Cygwin, start VectorCAST by entering:
$VECTORCAST_DIR/vcastqt
Windows
In Windows, from the Windows Start menu, select => All Programs => VectorCAST =>
VectorCAST.
VECTORCAST INTERFACE 7
VectorCAST Interface
Below we discuss the default controls of the VectorCAST GUI. Note that you can return to this
default arrangement at any time by using: View =>Default Layout from the menu bar.
l The Project Tree is located on the left-hand side of the main window. It provides a high level view
of the project structure.
l The Message Window is located along the bottom left of the main window. It contains tabs for
informational messages and for error messages.
l The Multiple Document Interface (MDI) Window is located to the right of the Project Tree. It
displays a variety of windows, including Test Case editors, Coverage Viewers, Report Viewers and
Text Editors. Windows are collected into groups. See the VectorCAST User Guide for more
information on MDI Window Groups.
VECTORCAST INTERFACE 8
l The Jobs Monitor is located on the bottom of the main window. It displays the status of jobs as
they execute and exposes the associated back-end commands. See the VectorCAST User Guide for
more information on the Jobs Monitor.
The Project Tree and the Message Window are docking windows and can be moved to any location on
your desktop. See the VectorCAST User Guide for more information on docking windows.
The Jobs Monitor is hidden by default when VectorCAST is first opened. Hover over the Jobs tab to
open the Jobs Monitor window and move the mouse away from the tab to close the window. To keep the
window open, click the Pin icon to the right of the Jobs tab.
The Status Bar on the lower right will display the path to the working directory, the status of the
environment, and the type of Coverage initialized.
The VectorCAST tools and functions are available from the Menu Bar and the Toolbar located at the
top of the main window. The toolbar includes icons for third-party tools integrated with VectorCAST and
are functional only if you are licensed for those features. You can become familiar with the most widely
used of these tools and functions by using the Interactive Tutorials.
USING THE VECTORCAST EXAMPLES 9
The examples are accessed via the VectorCAST Examples page in the "Getting Started" MDI window
that appears when you start the product. To navigate to the Examples Welcome page from anywhere
within VectorCAST, select Help =>Welcome from the Menu Bar.
The VectorCAST Examples page containing links to all the examples is displayed:
USING THE VECTORCAST EXAMPLES 10
The VectorCAST Testing Examples provide source code and test scripts to allow you to quickly learn the
features of VectorCAST/C++.
To create a Testing Environment, navigate to the VectorCAST Examples Welcome page and under the
C Examples column, select Tutorial for C. Alternatively, from the Menu Bar you can select Help
=>Example Environments =>C=>Tutorial for C. VectorCAST will automatically build the test
environment.
Note: For the purposes of this Quick Start Guide, the discussion will be based on the Tutorial for C
example. To create a C++ or an Ada Testing Environment, select Tutorial for C++ or Tutorial for
Ada from the Example Environments menu. The menu flow and concepts discussed will be the same
for all three programming languages.
Once the environment completes building, a summary page is provided for you in the MDI Window.
Refer to this page to learn more about basic test case construction concepts, and use the provided
hyperlinks on the right to interact with your test environment.
The Text Editor opens up in the MDI Window and you will see the source code for the selected file
displayed. The initial code display is read-only. To edit the source code, check the Writable box in the
lower right. Right-click with your mouse within the MDI Window to view a pop-up menu of editing
commands.
Note that after the test has executed the Project Tree updates to display the test case status. Passing test
cases are displayed in green. Failing test cases are displayed in red. Hover over the test case to see the
execution time and the percentage of expected values reached.
A new column is displayed in the Project Tree indicating statement coverage status. Hover over the status
bar to see that running test case PLACE_ORDER.001 achieves 58% statement code coverage for the
subprogram Place_Order, covering 10 out of 17 statements.
The Execution Results Report is displayed in the Report Viewer. The Report includes the configuration
of the test case, the execution results with the expected and actual values, and the test status. Refer to
your VectorCAST User Guide for more information on viewing test execution results.
VIEW THE TEST RESULTS 15
Depending on the items selected in the Project Tree, you can view the Execution Results for a single test
case, a combination of test cases, a subprogram or an environment by selecting Test =>View
=>Execution Results and viewing the Execution Results Report.
The Test Case Management Report is a summary of the testing status for a particular environment. First,
execute all the Test Cases. Right click on the Project Name in the Project Tree and select Execute or
select the Execute button from the Toolbar.
As the Test Cases execute you will see the Execution Status Monitor window open, allowing you to see
the output and status of each test as it is running in real time. Refer to your VectorCAST User Guide to
learn more about the Execution Status Monitor and Jobs Monitor windows.
Once the Test Cases have executed, you can view the Test Case Management Report by selecting Test
=>View =>Test Case Management Report from the Menu Bar.
The contents of the report reflect the items selected in the Project Tree. Scroll through the report and note
the information provided.
OPEN CODE COVERAGE VIEWER 16
An annotated version of the manager source code is displayed in the Coverage Viewer in the
OPEN CODE COVERAGE VIEWER 17
MDI Window. For display purposes here the example environment has been assigned Basis Paths
coverage type.
Create a System Testing
Environment
CREATE A SYSTEM TESTING ENVIRONMENT 19
To build the VectorCAST/QA example, navigate to the VectorCAST Examples Welcome page and under
the VectorCAST/QA column, select QA Demo. Alternatively, from the Menu Bar you can select Help
=>Example Environments =>QA =>QA Demo. VectorCAST will automatically build the QA Project.
In the Project Tree, note that the qa_demo project is displayed. Expand the nodes to show the cover_
demo environment. There are also three columns on the right to display coverage status for Statement,
Branch and MC/DC Pairs. Use your mouse to hover over the coverage bar for the qa_demo project and
observe that it has 55% Statement coverage.
To open and edit the Configuration Script, right-click on the cover_demo Environment node and select
System Testing => Edit Script from the context menu.
VIEW SYSTEM TEST SCRIPT 20
Note that the script contains the build command for the application. Also note the list of 6 system test
cases: Place_Order, Get_Check_Total, ClearTable, AddIncludedDessert, NextParty, and the
manual test case InitializeWB.
The script can be modified as required and the changes saved. We will use the existing script for our
example and simply close the text editor.
Next, you will build the instrumented executable using the system_tests.py script.
BUILD INSTRUMENTED EXECUTABLE 21
The Build Status column in the Project Tree now shows green check marks indicating successful build
status. Hover over the check marks to see popups with the build details.
The Manage Incremental Rebuild Report opens when the build is complete. Note that we made no
modifications to files or test cases, and the report shows a successful rebuild with no files, functions or
test cases affected.
EXECUTE TEST CASES 22
Also note that there are a total of 4 tests reported. Recall that we noted 6 tests are listed in the Python
Configuration Script. Two of the tests are missing here.
Next, we will run the missing test cases in the cover_demo environment.
In our example, only the two missing tests cases, NextParty and InitializeWB, were executed.
To learn more about System Testing environments, see the "VectorCAST/QA - System Test Automation"
section in the VectorCAST/Manage User Guide.
Create an Enterprise Testing Project
CREATE AN ENTERPRISE TESTING PROJECT 24
Before you start: The basic Manage example is built using any Unit Testing Environments you
created previously. If there are no existing environments, the Manage example will create a new unit
test environment using the Tutorial for C.
For our example, we will be importing the C, C++, C++ BlackBox, C++ Whitebox and Ada example
environments.
To set up for the Manage project, go to the VectorCAST Examples Welcome page and if the Tutorial for
C under the C Examples column does not have a green check mark displayed next to it, click to run the
example. Return to the VectorCAST Examples Welcome page and continue to click on each of the
following examples until each displays a green check mark: Tutorial for Ada, Tutorial for C++, Basic
Class (BlackBox), and Basic Class (Whitebox).
To create a Manage project, navigate to the VectorCAST Examples Welcome page and under the
VectorCAST/Manage column, select Manage Demo. Alternatively, from the Menu Bar you can select
Help =>Example Environments =>Manage =>Manage Demo. VectorCAST will automatically build
EXECUTE ALL TESTS 25
the Manage Project using the Unit Testing environments you created previously.
Once the project completes building, a VectorCAST/Manage Example summary page is provided for you
in the MDI Window. Refer to this page to learn more about basic Manage project concepts, and use the
provided hyperlinks on the right to interact with your project.
In the Project Tree you will now see the manage_demo project displayed. Note that a Test Suite has been
created which contains each of the environments. Expand the Project Tree to see the individual
Environments.
As test cases are executed data is stored in a SQL database and used to generate reports showing testing
status and trends, making it easy to analyze regression trends.
The Status Panel updates to display testing status. On the status panel you will see status for the
Environment Build, Test Execution and Statement Coverage. Hover over the Statement Coverage bar to
VIEW MANAGE SUMMARY 26
Alternatively, from the Menu Bar, select Project => Manage Summary.
The Manage Summary opens and displays data for all five environments in our manage_demo project.
VIEW CODE COVERAGE SUMMARY 27
The Manage Summary is dynamic and tracks the current selection in the Project Tree. Try selecting
different environment nodes and note that as units are selected and deselected in the Project Tree, the
Manage Summary table updates in real time reflecting the selections.
The data displayed in the Manage Data Summary includes the Environment name, Build Status, Build
Time, number of Test Cases, number of Expected Values, Execution Time and achieved coverage for each
coverage type.
The Totals row at the top of the table displays the totals for each data column. In the example above,
note that in the manage_demo project we have a total of 10 test cases, covering 50 statements.
Sorting and filtering is available to locate data of interest. Sort by clicking on any column heading.
Access the filter by typing into the top row of any column.
See the VectorCAST/Manage User Guide for more detailed information on the Manage Summary table.
Summary => Code Coverage Summary from the Data Summary Report icon drop-down menu.
Alternatively, from the Menu Bar, select Coverage => Code Coverage Summary => Code Coverage
Summary.
On initial open, the Code Coverage Summary table displays coverage data for all environments in the
Manage project. By default, the contents of the Code Coverage Summary reflect the source files selected
in the Files tab. Use the Files tab to select data of interest to be displayed in the summary. In our
example, we have selected the manager.cpp source file in the Files tab. A tracking icon is displayed
at the top of the Unit column indicating that the Code Coverage Summary is currently tracking selected
source files.
The Code Coverage Summary table is dynamic. When the Track Current Selection option is enabled, as
units are selected and deselected in the Files tab, the Code Coverage Summary table updates in real time
reflecting the selections. Try selecting different source files and note that as files are selected and
deselected in the Files tab, the Code Coverage Summary updates in real time reflecting the selections.
To override tracking of selected source files, open the drop-down menu for the Data Summary Report and
select Options => Track Current Selection. Remove the check next to the option. The tracking icon on
the Summary table will change to gray to indicate that the summary is now tracking all units in the
Files tab.
The data displayed in the Code Coverage Summary includes the Unit name, Subprogram name,
Cyclomatic Complexity (Vg), and the achieved coverage for each coverage type.
The Totals row at the top of the table displays the totals for each data column. In the example above,
note that in the unit manager.cpp we have a total of 41 statements, of which 16 statements are covered
and 25 are uncovered.
The Summary table updates whenever coverage data is updated. For example, the table refreshes when
VIEW FILE BASED COVERAGE 29
Sorting and filtering is available to locate data of interest. Sort by clicking on any column heading.
Access the filter by typing into the top row of any column.
See the VectorCAST/Manage User Guide for more detailed information on the Code Coverage Summary
table.
The coverage results for the selected file will open in the MDI Window. Scroll through the results for the
selected file. Note the bar in the upper right indicating that manager.c has 26% Statement coverage.
VIEW FILE BASED COVERAGE 30
For a quick view of the details of a specific file hover over the filename listed in the Files pane of the
Project Tree. The at-a-glance information includes the full path for the file, date and time of the
modification at the last build, an aggregate of statement coverage and a list of which environments use
the file.
To learn more about using Enterprise Testing Projects in your organization, refer to the
VectorCAST/Manage User Guide. There you will find examples of common work flow scenarios and in-
depth discussion of features and functionality.
Publish Project Metrics
VECTORCAST/ANALYTICS PROJECT METRICS 32
Once the Start Analytics icon is selected, the Analytics Controller opens in the MDI window. The
Automation Controller Output pane, displayed at the top of the Analytics Controller, shows the output of
the Automation Controller scripts.
At the completion of the Automation Controller scripts, the vcdash command is invoked and the
Analytics Server is launched. The Analytics Server Output pane, displayed at the bottom of the Analytics
Controller, shows the status of the launch.
At the bottom of the Analytics Controller, a Start Server/Stop Server button is available. A Start
UNDERSTANDING THE ANALYTICS DASHBOARD 33
Server/Stop Server option is also available from the Start Analytics drop-down menu on the Toolbar.
Clicking the Start Server button starts the Analytics Server on an available port and opens the Analytics
Dashboard in a browser window.
Clicking the Stop Server button shuts down the Analytics Server and the Analytics Dashboard remains
open in the browser. A message "Cannot reach server" is displayed on the Dashboard to alert the user that
the connection to the server has been terminated.
If the Analytics Server is running, and the Analytics Dashboard is not currently open in a browser,
selecting the Open Dashboard button from the bottom of the Analytics Controller or selecting the Open
Dashboard option from the Start Analytics drop-down menu opens the Analytics Dashboard in a
browser window. The button is only available if the Analytics Server has been launched.
Once the server has started, VectorCAST automatically opens a browser window displaying the Analytics
Dashboard for the open project.
l Project-wide Metrics
l Project Source Code Tree
UNDERSTANDING THE ANALYTICS DASHBOARD 34
Project-wide Metrics
Key project-wide Metrics are displayed in the top bar of the dashboard, providing an at-a-glance view of
the size, complexity and testing completeness of the project. Metrics include:
The Project-wide Metrics are functional buttons which control the sorting and display of the project's
Source Code Tree. In our example, the Statements button is selected, and the source code files are listed
in the Tree showing those having the greatest number of covered statements at the top.
UNDERSTANDING THE ANALYTICS DASHBOARD 35
The data displayed in the right column of the Source Code Tree is associated with the selected Metrics
button. Try selecting the Statement Coverage button, and note that the right column then shows the
percentage of statement coverage achieved, listed from lowest to highest percentage.
Note that the Source Code Tree uses an icon beside a file name and an icon beside a function
name. Clicking on a file name icon will open the file's source code in a Viewer. Clicking on a function
name icon will open the file's source code in a Viewer and will jump to the function's location in the
code.
Metrics Display
Metrics are displayed in the right of the browser for the file or files selected in the Source Code Tree. In
our example, we have selected the single file manager.c, and the dashboard displays the metrics
associated with that file.
The top three boxes provide the Metrics, Testing, and Static Analysis data for the selected file,
manager.c.
UNDERSTANDING THE ANALYTICS DASHBOARD 36
Below the boxes two heat maps are displayed for the file manager.c, one for Statements vs. Coverage
and one for Complexity vs. Coverage. Each function maps to a box in the heat map. Hovering over a box
displays the underlying data.
The size of the boxes within the heat maps reflects the number of statements or level of complexity of the
functions. Functions with a large number of statements or high complexity will be larger in size.
UNDERSTANDING THE ANALYTICS DASHBOARD 37
The color of the boxes within the heat map indicates the level of coverage of the functions.
Using the example above, we can easily identify that the function Add_Party_To_Waiting_List is a hot
spot which is highly complex and poorly tested. This information is critical in deciding how to best
allocate testing and refactoring resources on a project.
Tabular data is located by scrolling down the browser window. A set of four tables is provided showing
the Highest Complexity listed by file and by function, and the Least Coverage listed by file and by
UNDERSTANDING THE ANALYTICS DASHBOARD 38
function for the selected files. In this example, we have selected to view the metrics for the manager.c
unit. Note that the name of the source file is provided in parentheses to the right of the function name.
Clicking on any of the listed source file names or the icon in either the Source Code Tree or the
Metrics Tables will open the source code in a viewer. Clicking on the icon of a listed function will
open the source file and scroll to the function. Use the button in the Title Bar to close the viewer.
Coverage Viewer
Select one of the following buttons from the upper right of the Source Code Viewer's Title Bar to view
coverage for the source file:
- Opens the Coverage Viewer. This button is only available when the selected
file has covered branches, pairs or statements.
- Opens Lint Static Analysis results. This button is only available when the
selected file has Lint Static Analysis results.
UNDERSTANDING THE ANALYTICS DASHBOARD 39
- Opens Klocwork Analysis results. This button is only available when the
selected file has Klockwork Analysis results.
- Closes the Viewer and returns to the Analytics dashboard.
The Coverage Viewer provides an annotated version of the source file, colorized to indicate the coverage
level achieved. Green highlighted code indicates the line is covered. Red highlighted code indicates the
line is not covered. Yellow highlighted code indicates partial coverage for the line. In the example
below, the file manager.c shows Statement coverage:
Icons in the column on the left give additional information regarding coverage. Hover over an icon for
more information. The following icons (in combination with the red, green and yellow line highlighting)
are used to annotate the coverage level:
- Statement covered
- 41 -