C H A P T E R  28

Writing Conditional Output

New test packs should use the Logger API (see Logging) to write log file output. This chapter describes the legacy logging facility in the context of Java Device Test Suite version 2.2 or later.

The Runner.verbose() method conditionally writes a string to the harness test log, depending on the verboseLevel argument passed to it and the value of the harness’s Run Tests > Log Messages menu item. CODE EXAMPLE 28-1 shows the combinations that result in output.


CODE EXAMPLE 28-1 Conditions for Log Output

Flag Argument

Conditions When Written

Runner.VERBOSE

Run Tests > Log Messages > Verbose or lower

Runner.DEBUG

Run Tests > Log Messages > Debug or lower


In general, use Runner.DEBUG to document normal operations. The exception is messages noting the start of a test case, which uses Runner.VERBOSE. Use Runner.VERBOSE for test failure messages and messages providing information about failures.

CODE EXAMPLE 28-2 shows an example that produces output if the tester has has set Run Tests > Log Messages to Debug or lower.


CODE EXAMPLE 28-2 Writing a Diagnostic Message
Runner.verbose("The enumeration has " + renum.numRecords() + 
 " records", Runner.DEBUG);