User'S Guide: Test Coverage Analysis Tool For Java On Windows 2000/XP
User'S Guide: Test Coverage Analysis Tool For Java On Windows 2000/XP
Name:_______________________________
Company:____________________________
Address:_____________________________
______________________________
Phone________________________________
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ix
CHAPTER 2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1 System Requirements . . . . . . . . . . . . . . . . . . . . . . 15
2.2 Installation Procedure . . . . . . . . . . . . . . . . . . . . . . 16
2.3 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
iii
TABLE OF CONTENTS
CHAPTER 5 Cover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
5.1 Cover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
5.2 Trace File and Archive File Formats . . . . . . . . . . . . . . . 53
5.3 Cover Main Window . . . . . . . . . . . . . . . . . . . . . . . . 54
5.3.1 Tool Bar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.3.2 File Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.3.3 View Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.3.4 Window Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.3.5 Help Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.3.6 Status Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.4 File Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
iv
TCAT for Java/Windows User’s Guide
CHAPTER 6 DiGraph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.1 Purpose and Overview . . . . . . . . . . . . . . . . . . . . . . 67
6.2 Directed Graph File Format . . . . . . . . . . . . . . . . . . . 67
6.3 DiGraph Main Window . . . . . . . . . . . . . . . . . . . . . . 69
6.3.1 Tool Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70
6.3.2 File Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71
6.3.3 Zoom Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72
6.3.4 View Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73
6.3.5 Options Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74
6.3.6 Window Menu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74
6.3.7 Help Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74
6.3.8 Status Bar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74
6.4 File Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6.4.1 Open. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75
6.4.2 Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76
6.5 View Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
6.5.1 Viewing Associated Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . .77
6.6 Options Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
6.6.1 The Digraph Options Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . .78
6.7 Window Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
6.7.1 Cascade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
6.7.2 Tile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82
6.7.3 Arrange Icons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83
6.7.4 Window List Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83
CHAPTER 7 CallTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
7.1 Calltree Overview . . . . . . . . . . . . . . . . . . . . . . . . . 85
7.2 Generating and Viewing Calltrees . . . . . . . . . . . . . . . . 86
7.3 Calltree File Format . . . . . . . . . . . . . . . . . . . . . . . . 87
v
TABLE OF CONTENTS
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
vi
List of Figures
vii
LIST OF FIGURES
viii
Preface
Congratulations!
By choosing the TestWorks suite of testing tools, you have taken the first
step in bringing your application to the highest possible level of quality.
Software testing and quality assurance, while increasingly important in
today’s competitive marketplace, can dominate your resources and delay
your product release. By automating the testing process, you can assure
the quality of your product without needlessly depleting your resources.
Software Research, Inc. believes strongly in automated software testing. It
is our goal to bring your product as close to flawlessness as possible. Our
leading-edge testing techniques and coverage assurance methods are
designed to give you the greatest insight into your source code.
TCAT for Java/Windows is a quick and easy way to detect weaknesses in
your code. Easily accessible click-and-point reports find the segments
that need further testing. Digraphs and calltrees visualize the location,
allowing you to make immediate improvements to the structure and
performance of your software.
TestWorks is the most complete solution available, and the peace of mind
it provides our customers is our most valued feature.
Thank you for choosing TestWorks.
Audience
This manual is intended for software testers who are using TCAT for Java/
Windows. You should be familiar with the Microsoft Windows System and
your workstation.
ix
PREFACE
Typefaces
Typographical conventions that are used throughout this manual:
boldface Introduces or emphasizes a term that refers to
TestWorks’ window, its submenus and its options.
italics Indicates the names of files, directories, pathnames,
variables, and attributes. Italics is also used for man-
ual, chapter, and book titles.
”Double Quotation Marks”
Indicates chapter titles and sections. Words with
special meanings can also be set apart with double
quotation marks the first time they are used.
courier Indicates system output such as error messages,
system hints, file output, and CAPBAK/MSW’s
keysave file language.
Boldface Courier
Indicates any command or data input that you are
directed to type. For example, prompts and invoca-
tion commands are in this text. (stw, for instance,
invokes TestWorks.)
x
CHAPTER 1
1
CHAPTER 1: TCAT for Java/Windows Overview
2
TCAT for Java/Windows User’s Guide
3
CHAPTER 1: TCAT for Java/Windows Overview
User
4
TCAT for Java/Windows User’s Guide
5
CHAPTER 1: TCAT for Java/Windows Overview
6
TCAT for Java/Windows User’s Guide
Source
Program
Manual
Analysis
Supporting Static
Documents Analysis Archived Test
Files
Archived Test
Dynamic Documents
Analysis
7
CHAPTER 1: TCAT for Java/Windows Overview
1.6.1 Bottom-Up
In the bottom-up approach, testing begins at the lowest level in the
system hierarchy; that is, modules that invoke no other module. Each
bottom-level module is tested individually with special test data. Mod-
ules at each subsequent level of the hierarchy are tested using already-
tested lower-level modules. The process continues until all modules have
been thoroughly exercised. Thus, you can control testing carefully as you
progress up the system hierarchy.
1.6.2 Top-Down
In the top-down approach, testing begins at the highest level in the
system hierarchy. Sometimes module “stubs”' are used to simulate
invoked modules to check the high-level logic of the program. As an
alternative to using module stubs, use a complete program with only a
few selected modules instrumented. TCAT for Java ignores uninstru-
mented modules as it traces test coverage through the program.
In top-down analysis, the tester is chiefly concerned with the combination
of modules to form a larger system. TCAT for Java focuses specifically on
function calls within the system, so that the tester can verify each inter-
connection.
8
TCAT for Java/Windows User’s Guide
9
CHAPTER 1: TCAT for Java/Windows Overview
40 defects/KLOC 40 defects/KLOC
20 defects/KLOC 5 defects/KLOC
10
TCAT for Java/Windows User’s Guide
1000
Larger Software Projects
500
200
100
80%
50 Median (TRW Survey)
20%
20
10
5 Smaller Software
Projects
2
1
Requirements Design Code Dev. Tests Acceptance Tests Operation
11
CHAPTER 1: TCAT for Java/Windows Overview
12
TCAT for Java/Windows User’s Guide
13
CHAPTER 1: TCAT for Java/Windows Overview
14
CHAPTER 2
Installation
This chapter describes the system requirements and the step-by-step installation
procedure for TCAT for Java/Windows
15
CHAPTER 2: Installation
16
TCAT for Java/Windows User’s Guide
setup.exe presents you with a series of dialog boxes, beginning with the
Welcome box shown below. Each box is a step in the installation process,
and when you are satisfied with the options offered in a box you should
click Next to go on to the next step.
17
CHAPTER 2: Installation
18
TCAT for Java/Windows User’s Guide
After selecting Next, the Setup Type dialog box pops up and asks you
what kind of installation you prefer. It is highly recommended that you
select Custom installation, which allows you to install the FrameReader
software that allows you to read the online help that accompanies TCAT
for Java/Windows. (Be aware that the FrameReader software will occupy
approximately 9 MB of your computer’s memory.)
19
CHAPTER 2: Installation
20
TCAT for Java/Windows User’s Guide
21
CHAPTER 2: Installation
22
CHAPTER 3
Quick Start
This chapter explains getting started with TCAT for Java/Windows using a demonstra-
tion test case. It then describes the main features of the product.
23
CHAPTER 3: Quick Start
For the first time user, check your Java manual to see how the environ-
ment variables are set. Add $TCAT-Java_DIR\Program\ to CLASSPATH.
( e.g. set CLASSPATH=.;C:\jdk1.1.4\lib\classes.zip; C:\Program Files\
Software Research\Coverage\TCAT-Java\Program) )
24
TCAT for Java/Windows User’s Guide
WinIJava instruments the application under test so that any tests can
produce trace files.
To instrument the example application:
1. Start up WinIJava.
Note: More than one file can be selected and instrumented, and
instrumenting multiple files results in more thorough coverage.
25
CHAPTER 3: Quick Start
3. Select Instrument.
A copyright box pops up before the instrumentation of each file if
the license is invalid. During instrumentation, a command-line win-
dow displays messages and warnings. The instrumentor parses the
applet’s source code, looking for logical branches or segments and
inserting markers (function calls).
Instrumenting a program does not change its functionality. When
compiled, and executed, the instrumented application behaves as it
normally does, except that it writes coverage data to a trace file. For
more information on TCAT for Java/Windows’ instrumentor, refer to
Chapter 4.
4. When instrumentation is complete, select Close from the WinIJava
window.
26
TCAT for Java/Windows User’s Guide
27
CHAPTER 3: Quick Start
When the TicTacToe is running, your display should look like this:
28
TCAT for Java/Windows User’s Guide
29
CHAPTER 3: Quick Start
30
TCAT for Java/Windows User’s Guide
31
CHAPTER 3: Quick Start
32
TCAT for Java/Windows User’s Guide
33
CHAPTER 3: Quick Start
34
TCAT for Java/Windows User’s Guide
35
CHAPTER 3: Quick Start
The next step shows how to look at digraphs of the possible program
flows belonging to this function.
36
TCAT for Java/Windows User’s Guide
3.1.7 Step 7 - Viewing the Directed Graph Associated With a Calltree Node
To display a directed graph of any callpair shown in the calltree:
1. Select a node by clicking on it.
Notice that the View Digraph button on the toolbar now has a red
arrow, indicating that it is available.
2. To display a directed graph of the selected function, click the View
DiGraph button.
37
CHAPTER 3: Quick Start
38
TCAT for Java/Windows User’s Guide
39
CHAPTER 3: Quick Start
3.2 Summary
If you have completed the proceeding steps successfully, you have seen
and practised the basic skills you need to use TCAT for Java/Windows
productively. You should have learned how to invoke TCAT for Java/
Windows, how to instrument, compile, and run a program, and how to
look at the coverage reports.
For best learning you may want to:
• Repeat STEPS 1 - 9 without the manuall and experiment by run-
ning the applet several times and looking at the amount of cover-
age your test input receives.
• Repeat STEPS 1 - 9 with your applet.
• Review the chapters on system operation where you had difficul-
ties. The table of contents can help you locate the topic you want.
40
CHAPTER 4
41
CHAPTER 4: Java Instrumentor Engine
42
TCAT for Java/Windows User’s Guide
FIGURE 18 WinIJava
WinIJava drives the instrumentor, IJava, according to selections made by
the user.
Select Click a file to select it for instrumentation, control-
click to select several files, or shift-click to select a
series of files.
Instrument Instruments the selected file(s). During instrumenta-
tion, a command-line box gives informational and
warning messages.
Options Selects among code languages and modes of instru-
mentation.
Close Exits WinIJava.
43
CHAPTER 4: Java Instrumentor Engine
44
TCAT for Java/Windows User’s Guide
45
CHAPTER 4: Java Instrumentor Engine
46
TCAT for Java/Windows User’s Guide
If you invoke IJava with the switches -TCAT-PD c:\AAA and -TCAT-
PN XXX on the file example.c, the directory tree created during instru-
mentation is as follows:
c:\
AAA
tcat_db
XXX
c_graph
example.cg
d_graph
example.dg
XXX.mdf
47
CHAPTER 4: Java Instrumentor Engine
48
TCAT for Java/Windows User’s Guide
49
CHAPTER 4: Java Instrumentor Engine
50
TCAT for Java/Windows User’s Guide
51
CHAPTER 4: Java Instrumentor Engine
Buffering level
Class Name
jrun1.class None
jrun10.class 10 Trace Hits
jrun100.class 100 Trace Hits
jrun10000.class 10000 Trace Hits
jrunInt.class Infinite, Trace hits are not written to trace
file until termination of application.
The larger the trace buffer the better the performance of your instrumen-
tal application. However, it should be noted that the trace records up to
the size of a buffer may be lost if the program is terminated abnormally.
52
CHAPTER 5
Cover
This chapter discusses Cover, the TCAT for Java/Windows complete TCAT Java analyzer
for branch (C1) and callpair (S1) metrics. This chapter applies to all editions of the prod-
uct.
5.1 Cover
Cover analyzes the trace files created when an instrumented program is
executed, and generates reports based on the trace file data.These cover-
age reports can be tailored to show a variety of data, including:
• segments hit
• segments not-hit
• past-test and cumulative coverage percentages
Cover makes the following assumptions:
• A [possibly empty] archive file and a current [possibly empty]
trace file exist.
• There is a file containing the names of the files in the project.
• The actual update of trace + archive --> archive is optional at end
of a session.
The package maintains its usual rules for precedence of archive over
trace, and displays warning messages when it finds size differences
between archive and trace file.
53
CHAPTER 5: Cover
5.3 Cover Main Window
Once you have built an instrumented version of your application and
exercised it, follow these steps to display a coverage report:
1. From the Programs menu, select TCAT for Java folder.
2. From the resulting window, select Cover icon.
3. From the File menu, select Open.
4. In the Open dialogue box, click on the filename Trace.trc in the tcat_db
directory.
A coverage report on the application appears.
54
TCAT for Java/Windows User’s Guide
55
CHAPTER 5: Cover
56
TCAT for Java/Windows User’s Guide
57
CHAPTER 5: Cover
5.4.1 Open
58
TCAT for Java/Windows User’s Guide
5.4.2 Print
59
CHAPTER 5: Cover
5.5.1 Cascade
This option arranges your windows in a cascade, with the active window
top-most and highlighted.
5.5.2 Tile
This option arranges the windows so that a portion of each window is
displayed. The active window is highlighted.
60
TCAT for Java/Windows User’s Guide
61
CHAPTER 5: Cover
62
TCAT for Java/Windows User’s Guide
Note that the calltree shows two callpairs: these are the same two call-
pairs registered by the coverage report in Figure 15 as having been exer-
cised seven times each by the test of TicTacToe. The coverage report
shows that the percentage of S1 coverage (coverage of call pairs) was
100% for this function.
Note that the digraph shows three segments. The coverage report shown
in Figure 32 registered that the test of TicTacToe hit two of these segments
seven times each and one of them not once. The coverage report shows
that the percentage of C1 coverage (branch coverage) was 66.67%.
63
CHAPTER 5: Cover
64
TCAT for Java/Windows User’s Guide
To look more closely at the segments, highlight one of the graphic lines in
the digraph by clicking on it close to the number. Then use the Source
Code button to display the associated source code.
FIGURE 30 Digraph and Source Code Associated with One of Its Segments
65
CHAPTER 5: Cover
66
CHAPTER 6
DiGraph
This chapter provides details on viewing and using directed graphs in TCAT for Java/
Windows.
67
CHAPTER 6: DiGraph
Succession
A Statement:
statement A;
B statement B;
Alteration
Statement:
A statement A;
if condition then
statement B;
B C else
statement C;
end if;
Iteration
Statement:
A statement A;
while condition
B statement B;
C
loop;
statement C;
Case Statement:
case element is
when value-1--
Statement A;
A B C when value-2---
Statement B;
when value-3---
statement C;
end case;
68
TCAT for Java/Windows User’s Guide
69
CHAPTER 6: DiGraph
70
TCAT for Java/Windows User’s Guide
71
CHAPTER 6: DiGraph
72
TCAT for Java/Windows User’s Guide
73
CHAPTER 6: DiGraph
74
TCAT for Java/Windows User’s Guide
6.4.1 Open
75
CHAPTER 6: DiGraph
6.4.2 Print
76
TCAT for Java/Windows User’s Guide
77
CHAPTER 6: DiGraph
Characteristics
78
TCAT for Java/Windows User’s Guide
Node You can choose different sizes and shapes for the di-
graph’s nodes. In this window, you can change the
space between nodes and their height-to-width ratio.
You have four choices for shapes: Circle, Box, Oval or
Outlined (the circle is drawn but not filled). The de-
fault setting is Circle.
• You can choose the size of the circle, box or
oval. The default size is 1.0.
• You can change the amount of space
between nodes. The default setting is 1.0.
• You can change the height-to-width ratio (for
ovals or box shapes only). The default set-
ting is 1.0.
79
CHAPTER 6: DiGraph
80
TCAT for Java/Windows User’s Guide
6.7.1 Cascade
This option arranges your windows in a cascade, with the active window
top-most and highlighted.
81
CHAPTER 6: DiGraph
6.7.2 Tile
This option arranges the windows so that a portion of each window is
displayed. The active window is highlighted.
82
TCAT for Java/Windows User’s Guide
83
CHAPTER 6: DiGraph
84
CHAPTER 7
CallTree
This chapter provides details about using calltrees in TCAT for Java/Windows.
85
CHAPTER 7: CallTree
86
TCAT for Java/Windows User’s Guide
87
CHAPTER 7: CallTree
88
TCAT for Java/Windows User’s Guide
89
CHAPTER 7: CallTree
90
TCAT for Java/Windows User’s Guide
7.5.1 Open
91
CHAPTER 7: CallTree
92
TCAT for Java/Windows User’s Guide
93
CHAPTER 7: CallTree
94
TCAT for Java/Windows User’s Guide
7.7.1 Cascade
This option arranges your windows in a cascade, with the active window
top-most and highlighted.
95
CHAPTER 7: CallTree
7.7.2 Tile
This option arranges the windows so that a portion of each window is
displayed. The active window is highlighted.
96
TCAT for Java/Windows User’s Guide
97
CHAPTER 7: CallTree
98
APPENDIX A
99
APPENDIX A: Java Instrumentor Engine Database Files
100
TCAT for Java/Windows User’s Guide
101
APPENDIX A: Java Instrumentor Engine Database Files
102
TCAT for Java/Windows User’s Guide
103
APPENDIX A: Java Instrumentor Engine Database Files
104
APPENDIX B
0 1 1 0 0 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 82 0 0 0 (1) 0 0 0
1 2 2 0 2 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 82 0 0 0 <DONE 0 0 0
2 1 4 0 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 83 0 0 0 ((i&pos)==pos) 0 0 0
2 1 5 0 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 86 0 0 0 ((i&pos)==pos) 0 0 0
1 3 3 0 2 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 87 0 0 0 <DONE 0 0 0
0 1 1 1 0 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 109 0 0 0 (1) 0 0 0
1 2 2 1 2 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 112 0 0 0 <9 0 0 0
2 3 4 1 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 114 0 0 0 (((white&(1<<mw))==0)&&((black&(1<<mw))==0)) 0 0 0
3 4 6 1 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 116 0 0 0 (won[pw]) 0 0 0
3 4 7 1 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 120 0 0 0 (won[pw]) 0 0 0
4 5 8 1 2 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 120 0 0 0 <9 0 0 0
5 6 10 1 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 121 0 0 0 (((pw&(1<<mb))==0)&&((black&(1<<mb))==0)) 0 0 0
6 4 12 1 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 123 0 0 0 (won[pb]) 0 0 0
6 4 13 1 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 127 0 0 0 (won[pb]) 0 0 0
5 4 11 1 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 128 0 0 0 (((pw&(1<<mb))==0)&&((black&(1<<mb))==0)) 0 0 0
4 7 9 1 2 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 130 0 0 0 <9 0 0 0
7 1 14 1 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 130 0 0 0 (bestmove==-1) 0 0 0
7 1 15 1 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 133 0 0 0 (bestmove==-1) 0 0 0
2 1 5 1 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 134 0 0 0 (((white&(1<<mw))==0)&&((black&(1<<mw))==0)) 0 0 0
1 8 3 1 2 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 135 0 0 0 <9 0 0 0
8 9 16 1 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 135 0 0 0 (bestmove!=-1) 0 0 0
8 9 17 1 1 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 140 0 0 0 (bestmove!=-1) 0 0 0
9 10 18 1 2 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 140 0 0 0 <9 0 0 0
B.1.1 c_graph Files
This is a typical c_graph file:
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::myMove(boolean) bestMove(int,int,int) 1 3 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 174 0 0 3
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::mouseUp(boolean) status(int,TicTacToe&) 1 7 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 249 0 0 1
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::mouseUp(boolean) yourMove(boolean,TicTacToe&,int) 2 7 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 267 0 0 6
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::mouseUp(boolean) status(int,TicTacToe&) 3 7 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 270 0 0 7
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::mouseUp(boolean) myMove(boolean,TicTacToe&) 4 7 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 280 0 0 12
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::mouseUp(boolean) status(int,TicTacToe&) 5 7 C:\JAVA\TEST\TICTAC~1\TicTacToe.java 282 0 0 13
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::isWon(void) 0 111 5 0
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::bestMove(int,int) 1 111 21 0
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::yourMove(boolean,int) 2 111 5 0
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::myMove(boolean) 3 111 3 1
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::status(int) 4 111 7 0
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::init(void) 5 111 1 0
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::paint(void) 6 111 9 0
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::mouseUp(boolean) 7 111 18 5
C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::getAppletInfo(int) 8 111 1 0
B.1.3 Trace Files and Archive Files
This is a typical trace file or archive file:
#Format 3.0
# TCAT for Java (tm) Version 1.2
# Copyright 1997 by Software Research, Inc.
# 11-18-1997
# Profile for project 'Prj_Name':
p Prj_Name 9 8
n C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::isWon(void) 0 111 5 0
n C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::bestMove(int,int) 1 111 21 0
n C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::yourMove(boolean,int) 2 111 5 0
n C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::myMove(boolean) 3 111 3 1
n C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::status(int) 4 111 7 0
n C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::init(void) 5 111 1 0
n C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::paint(void) 6 111 9 0
n C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::mouseUp(boolean) 7 111 18 5
n C:\JAVA\TEST\TICTAC~1\TicTacToe.TicTacToe::getAppletInfo(int) 8 111 1 0
# End of profile for project 'Prj_Name'.
s 0 1 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 4 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 5 1
s 0 2 1
s 0 5 1
APPENDIX C
These are the options on how to invoke cover9. This command, used inside the
TCAT for Java graphical user interface, is used to produce a coverage report which,
optionally, can report results in a Reference Listing. The Reference Listing report allows
you to look up a segment in order to identify the actual unexecuted code, and plan new
test cases.
C.1 Command Line Invocation
The complete syntax for calls to cover9 is listed below. Items enclosed in
[brackets] are to be included zero or more times.
108
APPENDIX C: cover9 —TCAT for Java’s Coverage Analyzer
[-P0]
[-P1]
[-q]
[-r report]
[-S0]
[-S1]
[-s]
[-SU]
[-T [threshold]]
[-w width]]
C.2 Cover9 Switch Definitions
The options may be used to vary the processing and reports generated by
cover9. The options are listed in alphabetical order.
[tracefile [tracefile]] These are the names of the trace files that you wish to
process. If there are no trace files then cover9 looks for
data in the default trace file name Trace.trc.
If there are no names given, and Trace.trc is not
present then an error message is issued.
If there are multiple trace files, each trace file is pro-
cessed in the order presented.
Caution: The list of trace files must be the first set of argu-
ments. The list is ended by the first symbol that appears
with a '-', i.e. by the first optional switch.
-a old-archive Old Archive File Name Switch.You can include data
from an old archive file in your reports. On the stan-
dard cumulative coverage report, this data will be in-
cluded in the “Cumulative Summary” test results,
but not under the column “Test”. To test iteratively,
progressing through a structured series of tests to-
wards higher C1 values, each run of cover should in-
clude the cumulative archive file from the previous
test.
If you do not include an archive file, the “Cumulative
Summary” figures will be the same as those for
“Test”. Alternatively, if no -a option is given, the file
Archive is used by default.
The -a option interacts with the other report options
discussed below.
109
TCAT for Java’s Coverage Analyzer
Caution: Each time you run cover9, you will write over the contents of
the Archive file unless you use the -f switch to direct the Archive file to
another place. You may wish to remove the filename before starting a
new test sequence.
110
APPENDIX C: cover9 —TCAT for Java’s Coverage Analyzer
111
TCAT for Java’s Coverage Analyzer
-nl namefile Name List Switch. This switch specifies that only the
list of module names found in the specified namefile
file is to be reported on in the current coverage report.
Coverage on other module names that may appear in
the archive or supplied trace files are ignored; howev-
er, the data is accumulated in the archive file.
The names used must be specified one name per line.
White space (tabs, spaces, etc.) on the line is ignored.
The following reports are affected by the existence of
a namefile:
•Cumulative Report
•Past Report
•Not Hit Report
•Hit Report
•Newly Hit Report
•Newly Missed Report.
The histogram outputs are not affected. There is a
separate name mechanism that can be used to pro-
duce individual histogram reports.
-NM Newly Missed Report Switch. This option produces the
Newly Missed report. Shows which segments, by
module, hit in any prior test that were not hit in the
current test. This shows what the current test “lost”.
This output is the complement of the Newly Hit re-
port.
-p Past Report Switch. Print only the Past Test report; this
option should be used in conjunction with the -a op-
tion when you want to analyze the overall perfor-
mance of a set of past tests.
-q Quiet Output Switch. Suppress printout of current ver-
sion and release information (this can be used to facil-
itate running cover9 in batch mode).
-r report Coverage Report File Name Switch. Normally the report
is written to the file Coverage (the default name), but
you can rename the file with this switch. CAUTION:
You will overwrite any file you name with this
switch.
-S1 Call-Pair Coverage Switch. If present, the report will
show call pair coverage.
112
APPENDIX C: cover9 —TCAT for Java’s Coverage Analyzer
NOTE: Unless at least one of -C1, -S1, or -S0 is turned on, no coverage
report will be generated. However, not both -S1 and -S0 can be present; if
they are then only -S1 is assumed.
113
Index
114
INDEX
digraph nodes 67
directed graph sample 106
viewing from Calltree 37 multiple-module testing 8
Directed Graph Listing 27, 42
directed graphs 31, 33, 67 O
dynamic analysis 7
online documentation
E FrameReader 19
H R
reference listing file 5
hardware configuration 15
reliability modeling 14
I S
IJava 43
S0 coverage 45
command line invocation 46
S1 coverage 45, 63
instrumentation 5, 25, 41, 43
S1 metric 3
function names 50
segment 62, 63
instrumenting module(s) 8
viewing associated source code 65
interactive option 45
segments hit 53
modes 43
segments not-hit 53
instrumentor directives 50
setup.exe 16, 17
instrumentor switches 46–49
SMARTS 13
software reliability 2
J source code 42
viewing from DiGraph 34
Java 15 SQA 1, 14
static analysis 6
static properties (of software) 6
L
logical branch 3, 5, 41, 67 T
TCAT for Java/Windows
M closing 39
editing the default path 18
manual analysis 6 uninstall 21
module definition file (mdf) 102, 106 TCAT Java/Windows
program group 20
115
TCAT Java User’s Guide
TCAT.mdf 86
tcat_db directory 46, 69, 86, 99
test cases 5
testing methods 6
text
"double quotation marks" x
boldface x
italics x
text, boldface x
text, courier x
text, italix x
TicTacToe.cg 27, 35, 42
TicTacToe.cpp 25
TicTacToe.dg 27, 31, 42, 69
TicTacToe.i 27, 42
TicTacToe.mdf 31, 69
top-down testing 8
trace file 5, 26, 41, 53
format 103, 107
sample 107
Trace.trc 29, 42
tutorial 15, 23
V
variable type rules 6
W
Windows 95 16, 39
Windows Explorer 16
Windows NT 39
WinIJava 25, 26, 41, 42, 43, 50
116