1 | <html>
|
---|
2 | <head>
|
---|
3 | <title>JProbe Tasks</title>
|
---|
4 | <link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
|
---|
5 | </head>
|
---|
6 | <body>
|
---|
7 |
|
---|
8 | <h1><a name="jprobe">JProbe</a></h1>
|
---|
9 | <p>by</p>
|
---|
10 | <ul>
|
---|
11 | <li>Stephane Bailliez (<a href="mailto:[email protected]">[email protected]</a>)</li>
|
---|
12 | </ul>
|
---|
13 | <h2>Introduction</h2>
|
---|
14 |
|
---|
15 | <p>This task runs the tools from the JProbe suite.<br>
|
---|
16 | For more information, visit <a href="http://www.sitraka.com">http://www.sitraka.com</a>.
|
---|
17 | An evaluation version is available for download if you already don't own it.
|
---|
18 | </p>
|
---|
19 |
|
---|
20 | <p>This task has been written using JProbe Suite Server Side 3.0.</p>
|
---|
21 |
|
---|
22 | <p>It is highly recommended to read the JProbe documentation to understand
|
---|
23 | the values of the command line arguments described below. This
|
---|
24 | document is less complete than the manual, it only gives the basic information
|
---|
25 | and is not intended as a replacement to the manual.
|
---|
26 | </p>
|
---|
27 |
|
---|
28 | <h2>Tasks</h2>
|
---|
29 | <table border="0" cellspacing="0" cellpadding="3">
|
---|
30 | <tr>
|
---|
31 | <td><a href="#jpcoverage">JPCoverage</a></td>
|
---|
32 | <td>Measure coverage of Java code.</td>
|
---|
33 | </tr>
|
---|
34 | <tr>
|
---|
35 | <td><a href="#jpcovmerge">JPCovMerge</a></td>
|
---|
36 | <td>Merge different snapshots into one.</td>
|
---|
37 | </tr>
|
---|
38 | <tr>
|
---|
39 | <td><a href="#jpcovreport">JPCovReport</a></td>
|
---|
40 | <td>Create a report from a snapshot</td>
|
---|
41 | </tr>
|
---|
42 | </table>
|
---|
43 |
|
---|
44 | <hr>
|
---|
45 |
|
---|
46 | <h2><a name="jpcoverage">JPCoverage</a></h2>
|
---|
47 | Perform code covering functions by comparing source code line execution to the programï¿œs source code as a whole.
|
---|
48 |
|
---|
49 | <h3>Parameters</h3>
|
---|
50 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
51 | <tr>
|
---|
52 | <td width="12%" valign="top"><b>Attribute</b></td>
|
---|
53 | <td width="78%" valign="top"><b>Description</b></td>
|
---|
54 | <td width="10%" valign="top"><b>Required</b></td>
|
---|
55 | </tr>
|
---|
56 | <tr>
|
---|
57 | <td valign="top">home</td>
|
---|
58 | <td valign="top">The directory where JProbe is installed.</td>
|
---|
59 | <td align="center" valign="top">Yes</td>
|
---|
60 | </tr>
|
---|
61 | <tr>
|
---|
62 | <td valign="top">vm</td>
|
---|
63 | <td valign="top">
|
---|
64 | Indicates which virtual machine to run.
|
---|
65 | Must be one of "jdk117", "jdk118" or "java2".If "java2" is specified, the user is
|
---|
66 | also required to specify a path via <tt>javaexe</tt>, otherwise it will check if
|
---|
67 | the current executing VM is 1.2+ and use its java.home property to determine its
|
---|
68 | location.</td>
|
---|
69 | <td align="center" valign="top">No, default to embedded VM if 1.2+</td>
|
---|
70 | </tr>
|
---|
71 | <tr>
|
---|
72 | <td valign="top">javaexe</td>
|
---|
73 | <td valign="top">The path to the java executable.</td>
|
---|
74 | <td align="center" valign="top">No, use only for java2 vm.</td>
|
---|
75 | </tr>
|
---|
76 |
|
---|
77 | <tr>
|
---|
78 | <td valign="top">applet</td>
|
---|
79 | <td valign="top">Run an applet. The default is false, unless the file under
|
---|
80 | analysis ends with htm or html.</td>
|
---|
81 | <td align="center" valign="top">No, default is "false".</td>
|
---|
82 | </tr>
|
---|
83 | <tr>
|
---|
84 | <td valign="top">seedname</td>
|
---|
85 | <td valign="top">Seed name for the temporary snapshot files (files will be named
|
---|
86 | seed.jpc, seed1.jpc, seed2.jpc, ...)</td>
|
---|
87 | <td align="center" valign="top">No, default to "snapshot"</td>
|
---|
88 | </tr>
|
---|
89 |
|
---|
90 | <tr>
|
---|
91 | <td valign="top">exitprompt</td>
|
---|
92 | <td valign="top">Toggles display of the console prompt: "Press Enter to close
|
---|
93 | this window." "always": Always displays the prompt. "never": Never displays the
|
---|
94 | prompt. "error": Only displays prompt after an error.</td>
|
---|
95 | <td align="center" valign="top">No, default is "never"</td>
|
---|
96 | </tr>
|
---|
97 |
|
---|
98 | <tr>
|
---|
99 | <td valign="top">finalsnapshot</td>
|
---|
100 | <td valign="top">Type of snapshot to send at program termination. Must be one
|
---|
101 | of "none","coverage","all"</td>
|
---|
102 | <td align="center" valign="top">No, default to "coverage"</td>
|
---|
103 | </tr>
|
---|
104 | <tr>
|
---|
105 | <td valign="top">recordfromstart</td>
|
---|
106 | <td valign="top">Must be one of "coverage", "all", "none". If you want
|
---|
107 | Coverage to start analyzing as soon as the program begins to run, use "all".
|
---|
108 | If not, select "none".</td>
|
---|
109 | <td align="center" valign="top">No, default to "coverage"</td>
|
---|
110 | </tr>
|
---|
111 | <tr>
|
---|
112 | <td valign="top">warnlevel</td>
|
---|
113 | <td valign="top">Set warning level (0-3, where 0 is the least amount of warnings).</td>
|
---|
114 | <td align="center" valign="top">No, default to 0</td>
|
---|
115 | </tr>
|
---|
116 | <tr>
|
---|
117 | <td valign="top">snapshotdir</td>
|
---|
118 | <td valign="top">The path to the directory where snapshot files are stored.
|
---|
119 | Choose a directory that is reachable by both the remote and local computers,
|
---|
120 | and enter the same path on the command line and in the viewer.</td>
|
---|
121 | <td align="center" valign="top">No, default to current directory</td>
|
---|
122 | </tr>
|
---|
123 | <tr>
|
---|
124 | <td valign="top">workingdir</td>
|
---|
125 | <td valign="top">The physical path to the working directory for the VM.</td>
|
---|
126 | <td align="center" valign="top">No, default is current directory.</td>
|
---|
127 | </tr>
|
---|
128 | <tr>
|
---|
129 | <td valign="top">tracknatives</td>
|
---|
130 | <td valign="top">Test native methods. Note that testing native methods with
|
---|
131 | Java 2 disables the JIT</td>
|
---|
132 | <td align="center" valign="top">No, default to "false".</td>
|
---|
133 | </tr>
|
---|
134 | <tr>
|
---|
135 | <td valign="top">classname</td>
|
---|
136 | <td valign="top">the name of the class to analyze.</td>
|
---|
137 | <td align="center" valign="top">Yes</td>
|
---|
138 | </tr>
|
---|
139 | </table>
|
---|
140 |
|
---|
141 | <h3><a name="nested">Nested Elements</a></h3>
|
---|
142 |
|
---|
143 | <h4>classpath</h4>
|
---|
144 | <p><code>jpcoverage</code> supports a nested <code><classpath></code>
|
---|
145 | element, that represents a <a href="../using.html#path">PATH like
|
---|
146 | structure</a>.</p>
|
---|
147 |
|
---|
148 | <h4>jvmarg</h4>
|
---|
149 |
|
---|
150 | <p>Additional parameters may be passed to the VM via nested <code><jvmarg></code>
|
---|
151 | attributes, for example:</p>
|
---|
152 |
|
---|
153 | <pre></pre>
|
---|
154 | <blockquote>
|
---|
155 | <pre><jpcoverage home="c:\jprobe" classname="MyClass">
|
---|
156 | <jvmarg value="-classic"/>
|
---|
157 | <classpath path="."/>
|
---|
158 | </jpcoverage>
|
---|
159 | </pre>
|
---|
160 | </blockquote>
|
---|
161 | would run the coverage on "MyClass" in classic mode VM.
|
---|
162 |
|
---|
163 | <p><code><jvmarg></code> allows all attributes described in <a
|
---|
164 | href="../using.html#arg">Command line arguments</a>.</p>
|
---|
165 |
|
---|
166 | <h4>arg</h4>
|
---|
167 |
|
---|
168 | <p>
|
---|
169 | Parameters may be passed to the executed class via nested <tt><arg></tt>
|
---|
170 | attributes, as described in <a href="../using.html#arg">Command line arguments</a>.
|
---|
171 | </p>
|
---|
172 |
|
---|
173 | <h4>socket</h4>
|
---|
174 | <p>Define a host and port to connect to if you want to do remote viewing.
|
---|
175 | </p>
|
---|
176 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
177 | <tr>
|
---|
178 | <td width="12%" valign="top"><b>Attribute</b></td>
|
---|
179 | <td width="78%" valign="top"><b>Description</b></td>
|
---|
180 | <td width="10%" valign="top"><b>Required</b></td>
|
---|
181 | </tr>
|
---|
182 | <tr>
|
---|
183 | <td valign="top">host</td>
|
---|
184 | <td valign="top">the host name/ip of the machine on which the Viewer is running</td>
|
---|
185 | <td align="center">No, default to localhost</td>
|
---|
186 | </tr>
|
---|
187 | <tr>
|
---|
188 | <td valign="top">port</td>
|
---|
189 | <td valign="top">The port number on which you will connect to the Viewer</td>
|
---|
190 | <td align="center">No, default to 4444</td>
|
---|
191 | </tr>
|
---|
192 | </table>
|
---|
193 |
|
---|
194 |
|
---|
195 |
|
---|
196 | <h4>filters</h4>
|
---|
197 |
|
---|
198 | <p>Defines class/method filters based on pattern matching.
|
---|
199 | The syntax is filters is similar to a <a href="../CoreTypes/fileset.html">fileset</a>.
|
---|
200 | </p>
|
---|
201 |
|
---|
202 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
203 | <tr>
|
---|
204 | <td width="12%" valign="top"><b>Attribute</b></td>
|
---|
205 | <td width="78%" valign="top"><b>Description</b></td>
|
---|
206 | <td width="10%" valign="top"><b>Required</b></td>
|
---|
207 | </tr>
|
---|
208 | <tr>
|
---|
209 | <td valign="top">defaultexclude</td>
|
---|
210 | <td valign="top">As a default, the coverage excludes all classes and methods.
|
---|
211 | Default filters are equivalent to
|
---|
212 | <pre>
|
---|
213 | <filters>
|
---|
214 | <exclude class="*" method="*"/>
|
---|
215 | </filters>
|
---|
216 | </pre>
|
---|
217 | </td>
|
---|
218 | <td align="center">No, default to "true"</td>
|
---|
219 | </tr>
|
---|
220 | </table>
|
---|
221 | <p>
|
---|
222 | As seen above, nested elements are <b><tt>include</tt></b> and <b><tt>exclude</tt></b>
|
---|
223 | with a <tt>name</tt> attribute.
|
---|
224 | </p>
|
---|
225 | <blockquote>
|
---|
226 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
227 | <tr>
|
---|
228 | <td width="12%" valign="top"><b>Attribute</b></td>
|
---|
229 | <td width="78%" valign="top"><b>Description</b></td>
|
---|
230 | <td width="10%" valign="top"><b>Required</b></td>
|
---|
231 | </tr>
|
---|
232 | <tr>
|
---|
233 | <td valign="top">class</td>
|
---|
234 | <td valign="top">The class mask as a simple regular expression</td>
|
---|
235 | <td align="center">No, defaults to "*"</td>
|
---|
236 | </tr>
|
---|
237 | <tr>
|
---|
238 | <td valign="top">method</td>
|
---|
239 | <td valign="top">The method mask as a simple regular expression</td>
|
---|
240 | <td align="center">No, defaults to "*"</td>
|
---|
241 | </tr>
|
---|
242 | <tr>
|
---|
243 | <td valign="top">enabled</td>
|
---|
244 | <td valign="top">is the filter enabled?</td>
|
---|
245 | <td align="center">No, defaults to true</td>
|
---|
246 | </tr>
|
---|
247 | </table>
|
---|
248 | </blockquote>
|
---|
249 |
|
---|
250 | <h3>Example of filters</h3>
|
---|
251 | <blockquote>
|
---|
252 | <pre><filters>
|
---|
253 | <include class="com.mycompany.*" method="*"/>
|
---|
254 | <exclude class="com.mycompany.MyClass" method="test*"/>
|
---|
255 | </filters></pre>
|
---|
256 | </blockquote>
|
---|
257 |
|
---|
258 | reports the coverage on all packages, classes and methods from <tt>com.mycompany</tt>
|
---|
259 | except all methods starting by <tt>test</tt> on the class <tt>MyClass</tt>
|
---|
260 | in the package <tt>com.mycompany</tt>
|
---|
261 |
|
---|
262 | <h4>triggers</h4>
|
---|
263 |
|
---|
264 | <p>Define a number of events to use for interacting with the collection
|
---|
265 | of data performed during coverage. For example you may run a whole application
|
---|
266 | but only decide to collect data once it reaches a certain method and once it
|
---|
267 | exits another one.</p>
|
---|
268 | <p>
|
---|
269 | The only type of nested element is the <tt>method</tt> element (triggers are performed
|
---|
270 | on method) and it has the following attributes:
|
---|
271 | </p>
|
---|
272 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
273 | <tr>
|
---|
274 | <td width="12%" valign="top"><b>Attribute</b></td>
|
---|
275 | <td width="78%" valign="top"><b>Description</b></td>
|
---|
276 | <td width="10%" valign="top"><b>Required</b></td>
|
---|
277 | </tr>
|
---|
278 | <tr>
|
---|
279 | <td valign="top">name</td>
|
---|
280 | <td valign="top">The name of the method(s) as a regular expression. The name
|
---|
281 | is the fully qualified name on the form <tt>package.classname.method</tt></td>
|
---|
282 | <td align="center" valign="top">Yes</td>
|
---|
283 | </tr>
|
---|
284 | <tr>
|
---|
285 | <td valign="top">event</td>
|
---|
286 | <td valign="top">the event on the method that will trigger the action. Must be
|
---|
287 | "enter" or "exit".</td>
|
---|
288 | <td align="center" valign="top">Yes</td>
|
---|
289 | </tr>
|
---|
290 | <tr>
|
---|
291 | <td valign="top">action</td>
|
---|
292 | <td valign="top">the action to execute. Must be one of "clear",
|
---|
293 | "pause", "resume", "snapshot", "suspend",
|
---|
294 | or "exit". They respectively clear recording, pause recording,
|
---|
295 | resume recording, take a snapshot, suspend the recording and exit the program.
|
---|
296 | </td>
|
---|
297 | <td align="center" valign="top">Yes</td>
|
---|
298 | </tr>
|
---|
299 | </table>
|
---|
300 |
|
---|
301 | <h3>Example of triggers</h3>
|
---|
302 | <blockquote>
|
---|
303 | <pre><triggers>
|
---|
304 | <method name="ClassName.*()" event="enter" action="snapshot"/>
|
---|
305 | <method name="ClassName.MethodName()" event="exit" action="exit"/>
|
---|
306 | </triggers>
|
---|
307 | </pre>
|
---|
308 | </blockquote>
|
---|
309 |
|
---|
310 | <p>Will take a snapshot when it enters any method of the class <tt>ClassName</tt>
|
---|
311 | and will exit the program once it exits the method <tt>MethodName</tt> of the
|
---|
312 | same class.</p>
|
---|
313 |
|
---|
314 | <hr>
|
---|
315 | <h2><a name="jpcovmerge">JPCovMerge</a></h2>
|
---|
316 |
|
---|
317 | <h3>Description</h3>
|
---|
318 |
|
---|
319 | <p>Perform the merge of several snapshots into a single one.</p>
|
---|
320 |
|
---|
321 | <h3>Parameters</h3>
|
---|
322 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
323 | <tr>
|
---|
324 | <td width="12%" valign="top"><b>Attribute</b></td>
|
---|
325 | <td width="78%" valign="top"><b>Description</b></td>
|
---|
326 | <td width="10%" valign="top"><b>Required</b></td>
|
---|
327 | </tr>
|
---|
328 | <tr>
|
---|
329 | <td valign="top">home</td>
|
---|
330 | <td valign="top">The directory where JProbe is installed.</td>
|
---|
331 | <td align="center" valign="top">Yes</td>
|
---|
332 | </tr>
|
---|
333 | <tr>
|
---|
334 | <td valign="top">tofile</td>
|
---|
335 | <td valign="top">the output filename that will be the result
|
---|
336 | of the name.</td>
|
---|
337 | <td align="center" valign="top">Yes</td>
|
---|
338 | </tr>
|
---|
339 | <tr>
|
---|
340 | <td valign="top">verbose</td>
|
---|
341 | <td valign="top">Perform the merge in verbose mode giving
|
---|
342 | details about the snapshot processing.</td>
|
---|
343 | <td align="center" valign="top">No. Default to false</td>
|
---|
344 | </tr>
|
---|
345 | </table>
|
---|
346 |
|
---|
347 | <p>
|
---|
348 | <tt>jpcovmerge</tt> collects snapshots using the nested <a href="../CoreTypes/fileset.html"><code><FileSet></code></a>
|
---|
349 | element.
|
---|
350 | </p>
|
---|
351 |
|
---|
352 | <h3>Example of merge</h3>
|
---|
353 | <blockquote>
|
---|
354 | <pre><jpcovmerge home="c:\jprobe" tofile="merge.jpc" verbose="true">
|
---|
355 | <fileset dir="./snapshots">
|
---|
356 | <include name="snap*.jpc"/>
|
---|
357 | </fileset>
|
---|
358 | </jpcovmerge>
|
---|
359 | </pre>
|
---|
360 | </blockquote>
|
---|
361 | <p>
|
---|
362 | would run the merge in verbose mode on all snapshot files starting by <tt>snap</tt> in the
|
---|
363 | directory <tt>snapshots</tt>. The resulting file will be named <tt>merge.jpc</tt>.
|
---|
364 | </p>
|
---|
365 |
|
---|
366 | <hr>
|
---|
367 |
|
---|
368 | <h2><a name="jpcovreport">JPCovReport</a></h2>
|
---|
369 |
|
---|
370 | <h3>Description</h3>
|
---|
371 |
|
---|
372 | <p>Generate a readable/printable report of a snapshot. Note that you will need <a href="http://jakarta.apache.org/oro/index.html">Jakarta
|
---|
373 | Oro</a> in Ant classpath, to run the <tt>reference</tt> feature.</p>
|
---|
374 |
|
---|
375 | <h3>Parameters</h3>
|
---|
376 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
377 | <tr>
|
---|
378 | <td width="12%" valign="top"><b>Attribute</b></td>
|
---|
379 | <td width="78%" valign="top"><b>Description</b></td>
|
---|
380 | <td width="10%" valign="top"><b>Required</b></td>
|
---|
381 | </tr>
|
---|
382 | <tr>
|
---|
383 | <td valign="top">home</td>
|
---|
384 | <td valign="top">The directory where JProbe is installed.</td>
|
---|
385 | <td align="center" valign="top">Yes</td>
|
---|
386 | </tr>
|
---|
387 | <tr>
|
---|
388 | <td valign="top">format</td>
|
---|
389 | <td valign="top">The format of the generated report. Must be "xml", "html" or "text"</td>
|
---|
390 | <td align="center" valign="top">No, default to "html"</td>
|
---|
391 | </tr>
|
---|
392 | <tr>
|
---|
393 | <td valign="top">type</td>
|
---|
394 | <td valign="top">The type of report to be generated. Must be "executive",
|
---|
395 | "summary", "detailed" or "verydetailed"</td>
|
---|
396 | <td align="center" valign="top">No. Default to "detailed"</td>
|
---|
397 | </tr>
|
---|
398 | <tr>
|
---|
399 | <td valign="top">percent</td>
|
---|
400 | <td valign="top">A numeric value for the threshold for printing methods. Must
|
---|
401 | be between 0 and 100.</td>
|
---|
402 | <td align="center" valign="top">No, default to 100</td>
|
---|
403 | </tr>
|
---|
404 | <tr>
|
---|
405 | <td valign="top">snapshot</td>
|
---|
406 | <td valign="top">The name of the snapshot file that is the source to the report.</td>
|
---|
407 | <td align="center" valign="top">Yes</td>
|
---|
408 | </tr>
|
---|
409 | <tr>
|
---|
410 | <td valign="top">tofile</td>
|
---|
411 | <td valign="top">The name of the generated output file</td>
|
---|
412 | <td align="center" valign="top">Yes</td>
|
---|
413 | </tr>
|
---|
414 | <tr>
|
---|
415 | <td valign="top">includesource</td>
|
---|
416 | <td valign="top">Include text of the source code lines. Only applies to
|
---|
417 | format="xml" and type="verydetailed"</td>
|
---|
418 | <td align="center" valign="top">No. Defaults to "yes"</td>
|
---|
419 | </tr>
|
---|
420 | </table>
|
---|
421 |
|
---|
422 | <h4>sourcepath</h4>
|
---|
423 |
|
---|
424 | <p>
|
---|
425 | Path to source files can be set via nested sourcepath elements that are <a href="../using.html#path">PATH like structures</a>.
|
---|
426 | </p>
|
---|
427 |
|
---|
428 | <h4>reference (only applies to format="xml")</h4>
|
---|
429 |
|
---|
430 | <p>A reference is a set of classes whose coverage information will be checked
|
---|
431 | against. Since Coverage is only able to give you information about loaded
|
---|
432 | classes, it will only report classes that were at least used in some points in
|
---|
433 | your tests,
|
---|
434 | therefore you will not be able to know what classes are not exercised at all
|
---|
435 | during your tests. The reference is an additional feature that will analyze the
|
---|
436 | bytecode of all classes in a given classpath that match some filters and modify
|
---|
437 | the XML report accordingly. In short, it will:
|
---|
438 | </p>
|
---|
439 |
|
---|
440 | <ul>
|
---|
441 | <li>remove the classes that do not exists in the reference classpath. (For
|
---|
442 | example you might have in your report some helper test classes that you do
|
---|
443 | not want to appear in the report, but are unable to filter without adding
|
---|
444 | hundred of filters for all your classes).</li>
|
---|
445 | <li>add classes that exists in the reference set and match the filters but are
|
---|
446 | not reported.</li>
|
---|
447 | <li>remove abstract methods that are incorrectly reported in JProbe 3.0
|
---|
448 | (should be fixed in a later SP)</li>
|
---|
449 | <li>remove classes/methods that do not match the filters.</li>
|
---|
450 | </ul>
|
---|
451 | <blockquote>
|
---|
452 | <h4>classpath
|
---|
453 | </h4>
|
---|
454 |
|
---|
455 | <p>
|
---|
456 | Path to the reference set of files can be set via nested classpath elements that are <a href="../using.html#path">PATH like structures</a>.
|
---|
457 | </p>
|
---|
458 |
|
---|
459 | <h4>filters
|
---|
460 | </h4>
|
---|
461 |
|
---|
462 | <p>Nested elements are <b><tt>include</tt></b> and <b><tt>exclude</tt></b>
|
---|
463 | with a <tt>class </tt>and <tt>method </tt>attribute.
|
---|
464 | </p>
|
---|
465 | </blockquote>
|
---|
466 | <blockquote>
|
---|
467 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
468 | <tr>
|
---|
469 | <td width="12%" valign="top"><b>Attribute</b></td>
|
---|
470 | <td width="78%" valign="top"><b>Description</b></td>
|
---|
471 | <td width="10%" valign="top"><b>Required</b></td>
|
---|
472 | </tr>
|
---|
473 | <tr>
|
---|
474 | <td valign="top">class</td>
|
---|
475 | <td valign="top">The class mask as a simple regular expression</td>
|
---|
476 | <td align="center">No, default to *</td>
|
---|
477 | </tr>
|
---|
478 | <tr>
|
---|
479 | <td valign="top">method</td>
|
---|
480 | <td valign="top">The method mask as a simple regular expression</td>
|
---|
481 | <td align="center">No, default to *</td>
|
---|
482 | </tr>
|
---|
483 | </table>
|
---|
484 | </blockquote>
|
---|
485 |
|
---|
486 | <h3>Example of report</h3>
|
---|
487 | <blockquote>
|
---|
488 | <pre><jpcovreport home="c:\jprobe" snapshot="merge.jpc" format="xml" tofile="result.xml">
|
---|
489 | <sourcepath path="./src"/>
|
---|
490 | <reference>
|
---|
491 | <classpath path="./bin/classes"/>
|
---|
492 | <filters>
|
---|
493 | <include class="com.mycompany.*"/>
|
---|
494 | <exclude class="com.mycompany.MyClass" method="test*"/>
|
---|
495 | </filters>
|
---|
496 | </reference>
|
---|
497 | </jpcovreport>
|
---|
498 | </pre>
|
---|
499 | </blockquote><p>
|
---|
500 | would generate the report of the file <tt>merge.jpc</tt> and write it to <tt>result.xml</tt>
|
---|
501 | using the source path <tt>src</tt>. As well, it will modify the result.xml by
|
---|
502 | analyzing all classes in the <tt>./bin/classes</tt> that are port of the package
|
---|
503 | <tt>com.mycompany</tt> except the method that start by <tt>test</tt> from the class <tt>MyClass</tt>.
|
---|
504 | </p>
|
---|
505 |
|
---|
506 | <h3>Recommendation</h3>
|
---|
507 |
|
---|
508 | <p>If you generate your main code and your testcases in a separate directory,
|
---|
509 | say bin/classes and test/classes. You should mostly end up with a reference such
|
---|
510 | as:</p>
|
---|
511 | <blockquote>
|
---|
512 | <pre><reference>
|
---|
513 | <classpath path="./bin/classes"/>
|
---|
514 | </reference></pre>
|
---|
515 | </blockquote>
|
---|
516 | <p>With such a reference, your XML report will be cleaned up against parasite
|
---|
517 | classes from your testcases (that as a common practice, generally match the
|
---|
518 | exact package structure of the class you exercise).</p>
|
---|
519 | <h3>HTML reports</h3>
|
---|
520 | <p>You will find in Ant etc directory a stylesheet called coverage-frames.xsl.
|
---|
521 | This file can be used to generate a framed report a la javadoc similar to the
|
---|
522 | one for JUnit. It needs either Xalan 1.2.2 or Xalan 2.x.</p>
|
---|
523 | <p>Xalan 1.2.2 (you must have xalan.jar and bsf.jar in your classpath)
|
---|
524 | </p>
|
---|
525 | <pre><style processor="xalan" in="./reports/xml/results.xml" out="./reports/html/dummy.file"
|
---|
526 | style="${ant.home}/etc/coverage-frames.xsl">
|
---|
527 | <param name="output.dir" expression="'${basedir}/reports/html'"/>
|
---|
528 | </style></pre>
|
---|
529 | <p>Xalan 2.x (note the parameter without single quote)</p>
|
---|
530 | <pre><style processor="trax" in="./reports/xml/results.xml" out="./reports/html/dummy.file"
|
---|
531 | style="${ant.home}/etc/coverage-frames.xsl">
|
---|
532 | <param name="output.dir" expression="${basedir}/reports/html"/>
|
---|
533 | </style></pre>
|
---|
534 |
|
---|
535 | <hr>
|
---|
536 | <p align="center">Copyright © 2001-2002,2004 The Apache Software Foundation. All rights
|
---|
537 | Reserved.</p>
|
---|
538 | </body>
|
---|
539 | </html>
|
---|