You can write test reports in command mode by using the -writereport command as a separate write reports command or as part of a series of commands (such as run tests and audit test results).
Because the JavaTest harness executes commands in their command-line sequence, you must identify the work directory before the -writereport command and then provide the report directory as an option after the command.
The command format used in the following example is the single string arguments format. See Formatting a Command for descriptions and examples of the other command formats that you can use.
Example:
..; -workdirectory mywork-directory -writereport myreport-directory;...