Using SAFS Monitor
Debugging with SAFS Services

Updated 2013.06.10

Go to: SAFS DRIVER CONTROL, SAFS DRIVER CONTROL POF, Using Variables, Using POF, Using Step/Retry, JSAFS Usage, Service References


SAFS Monitor is an independent and convenient mechanism for controlling the execution and debugging of running SAFS tests.

Our standard SAFS Driver monitors the value of two predefined SAFSVARS variables:

Custom SAFS Drivers--like those available via Java API for SAFS (JSAFS)--can also take advantage of these SAFS Monitor features.
See the JSAFS Usage section in this document for more details!


Go to: TOP, SAFS DRIVER CONTROL POF, Using Variables, Using POF, Using Step/Retry, JSAFS Usage, Service References

'SAFS_DRIVER_CONTROL'

The values currently supported for this variable:


Go to: TOP, SAFS DRIVER CONTROL, Using Variables, Using POF, Using Step/Retry, JSAFS Usage, Service References

'SAFS_DRIVER_CONTROL_POF'

The values currently supported for this variable:


Go to: TOP, SAFS DRIVER CONTROL, SAFS DRIVER CONTROL POF, Using POF, Using Step/Retry, JSAFS Usage, Service References

Using SAFS Monitor Variables

The SAFS Monitor UI provides easy access for changing the value of SAFS_DRIVER_CONTROL and SAFS_DRIVER_CONTROL_POF, but the variables can also be changed from any process having access to STAF on the target machine.  That means a tester can change these from the command-line, a program, a running SAFS test, or even a remote machine properly configured with STAF and granted appropriate STAF Trust levels.

This provides an array of opportunities when needing to debug running SAFS tests.

For example, a tester can PAUSE the running test and:

The tester can essentially query the state of the entire SAFS framework.

The test can be paused via the PAUSE button on the SAFS Monitor. A running SAFS test can also initiate a PAUSE by setting the appropriate SAFS_DRIVER_CONTROL value:

Having PAUSED the test via the SAFS Monitor, via the running test, or any other mechanism; the user can now evaluate the state of the test. Typically this is done by reviewing the SAFSVARS variables thru a DOS Command window.
(SAFS Monitor will likely offer this feature automatically in a future upgrade.)

To get an idea on accessing SAFSVARS from the command-line, type the following and press ENTER:

The key SAFSVARS command we would most likely use for debugging as we step through a test would be SAFSVARS LIST. This will give us a snapshot of the value of every variable currently known to SAFS:

The information shown is the state of all variables and status for the test record that just finished executing.

If desired, with SAFSVARS SET we can create new variables or change the value of existing variables. Notice when referencing variable names directly with the SAFSVARS service we do not use the caret (^) symbol used in SAFS test tables.

A common practice at this point is to use SAFS Monitor to STEP through the test one record at a time monitoring the variable values with SAFSVARS LIST to make sure they are what we expect them to be.


Go to: TOP, SAFS DRIVER CONTROL, SAFS DRIVER CONTROL POF, Using Variables, Using Step/Retry, JSAFS Usage, Service References

Using POF (PAUSE ON FAILURE)

In the SAFS Monitor UI, this is a checkbox representing whether the test will PAUSE when a failure occurs.


Go to: TOP, SAFS DRIVER CONTROL, SAFS DRIVER CONTROL POF, Using Variables, Using POF, JSAFS Usage, Service References

Using Step/Retry

When PAUSED, each token of the current test command, no matter whether failed or not, is loaded in the Watch table as shown above. The Watch table can be hidden or shown by the 'Watch/Edit' toggle button.  The tokens in white are editable.  The remaining tokens in grey are not editable.

This allows the tester to debug a failing test step by (re)trying it with different values until the desired results are achieved.


Go to: TOP, SAFS DRIVER CONTROL, SAFS DRIVER CONTROL POF, Using Variables, Using POF, Using Step/Retry, Service References

JSAFS Usage:

Custom SAFS Drivers--like those available via Java API for SAFS (JSAFS)--can also take advantage of these SAFS Monitor features, if they choose to set/get the values of these same predefined variables.

Valid values for 'SAFS_DRIVER_CONTROL' are shown at top and can be referenced via JavaHook constants.
The same is true for 'SAFS_DRIVER_CONTROL_POF' values.

By default, a JSAFSDriver instance automatically supports and performs these SAFS Monitor functions whenever a DriverCommand or ComponentFunction is executed. A developer can disable these features by setting the jsafs.useSAFSMonitor field to 'false'.

By default, a JSAFSDriver instance that detects a SHUTDOWN request when running a DriverCommand or ComponentFunction--whether it was user-initiated through the SAFS Monitor interface or code-initiated by the developer--automatically attempts to close all SAFS Engines and services. It also attempts to run the JVM finalization routines and force a System.exit(0) -- a complete JVM shutdown. A developer can disable the JVM finalization and shutdown feature by setting the jsafs.systemExitOnShutdown field to 'false'.

The developer can also insert a call to the JSAFSDriver.checkSAFSMonitorStatus function at arbitrary points in the code to take advantage of these SAFS Monitor features.


Go to: TOP, SAFS DRIVER CONTROL, SAFS DRIVER CONTROL POF, Using Variables, Using POF, JSAFS Usage, Using Step/Retry

References to key SAFS services:

Remember, you can always refer to the available commands for each service at the command-line by using HELP, as shown for SAFSVARS below:

To get a list of all available STAF services you can always ask for the SERVICE LIST:

Documentation for the core STAF services can be found locally in the C:\STAF\docs installation directory, or you can look in the STAF archives for older STAF V2.6.11 documentation.  Testers can also refer to the STAF website for the latest STAF documentation if using later versions of STAF.

Go to: TOP, SAFS DRIVER CONTROL, SAFS DRIVER CONTROL POF, Using Variables, Using POF, Using Step/Retry, JSAFS Usage, Service References