next up previous contents index
Next: JPCovMerge Up: JProbe Coverage Previous: Parameters   Contents   Index

Nested Elements

classpath

jpcoverage supports a nested <classpath> element, that represents a PATH like structure.

jvmarg

Additional parameters may be passed to the VM via nested <jvmarg> attributes, for example:

<jpcoverage home="c:\jprobe" classname="MyClass">
  <jvmarg value="-classic"/>
  <classpath path="."/>
</jpcoverage>
would run the coverage on "MyClass" in classic mode VM.

<jvmarg> allows all attributes described in Command line arguments.

arg

Parameters may be passed to the executed class via nested <arg> attributes, as described in Command line arguments.

socket

Define a host and port to connect to if you want to do remote viewing.

Attribute Description Required
host the host name/ip of the machine on which the Viewer is running No, default to localhost
port The port number on which you will connect to the Viewer No, default to 4444

filters

Defines class/method filters based on pattern matching. The syntax is filters is similar to a fileset.

Attribute Description Required
defaultexclude As a default, the coverage excludes all classes and methods. Default filters are equivalent to
  <filters>
    <exclude class="*" method="*"/>
  </filters>
No, default to "true"

As seen above, nested elements are include and exclude with a name attribute.

Attribute Description Required
class The class mask as a simple regular expression No, defaults to "*"
method The method mask as a simple regular expression No, defaults to "*"
enabled is the filter enabled? No, defaults to true

Example of filters

<filters>
    <include class="com.mycompany.*" method="*"/>
    <exclude class="com.mycompany.MyClass" method="test*"/>
</filters>

reports the coverage on all packages, classes and methods from com.mycompany except all methods starting by test on the class MyClass in the package com.mycompany

triggers

Define a number of events to use for interacting with the collection of data performed during coverage. For example you may run a whole application but only decide to collect data once it reaches a certain method and once it exits another one.

The only type of nested element is the method element (triggers are performed on method) and it has the following attributes:

Attribute Description Required
name The name of the method(s) as a regular expression. The name is the fully qualified name on the form package.classname.method Yes
event the event on the method that will trigger the action. Must be "enter" or "exit". Yes
action the action to execute. Must be one of "clear", "pause", "resume", "snapshot", "suspend", or "exit". They respectively clear recording, pause recording, resume recording, take a snapshot, suspend the recording and exit the program. Yes

Example of triggers

<triggers>
  <method name="ClassName.*()" event="enter" action="snapshot"/>
  <method name="ClassName.MethodName()" event="exit" action="exit"/>  
</triggers>
Will take a snapshot when it enters any method of the class ClassName and will exit the program once it exits the method MethodName of the same class.


next up previous contents index
Next: JPCovMerge Up: JProbe Coverage Previous: Parameters   Contents   Index
Andrew Marlow 2003-07-08