Testing Paths

Introduction

Path testing is nothing more than ensuring that JSwat handles the classpath and sourcepath correctly. This document serves a dual purpose: it documents how the paths should be handled, and it describes how to verify that JSwat is working as expected.

Both the classpath and sourcepath are maintained by the PathManager class. It stores the paths in session properties.

How it should work

Classpath

The classpath session property can be modified under two conditions:

  1. The user specifically sets the path using either the classpath command or the "Set Classpath" dialog.
  2. The classpath session property is empty when JSwat starts. It is automatically set to the value of the java.class.path system property.

While the JSwat session is active, the classpath will appear to be that of the debuggee VM. After the session is deactivated, the classpath will return to the value before the session was activated.

Sourcepath

The sourcepath session property can be modified under two conditions:

  1. The user specifically sets the path using either the sourcepath command or the "Set Sourcepath" dialog.
  2. The java.source.path system property is set when JSwat starts, in which case this value will overwrite the sourcepath session property .

How to test

Remote Debuggee

Ensure that the classpath session property is not overwritten by simply connecting to a remote debuggee. This is accomplished using the following steps:

  1. Set the classpath to something memorable.
  2. Attach to a remote debuggee that has a different classpath than the one used in the previous step.
  3. Check that the classpath is indeed different.
  4. Disconnect from the remote debuggee.
  5. Verify that the classpath is the original value.

Setting the Paths

See the appropriate command and dialog test cases to learn how to test setting the classpath and sourcepath.