Printing input arguments to a file
The PrintArgs class prints its input arguments to the file C:\arguments.out. This class could be used, for example, to print a response returned by the server.
The Javadoc for the test execution services interfaces and classes can be accessed from the product by clicking
.package customcode;
import com.ibm.rational.test.lt.kernel.services.ITestExecutionServices;
import java.io.*;
/**
* The PrintArgs class prints its input arguments to the file
* C:\arguments.out. This example could be used to print a response
* returned by the server.
*/
/**
* @author IBM Custom Code Samples
*/
public class PrintArgs implements
com.ibm.rational.test.lt.kernel.custom.ICustomCode2 {
/**
* Instances of this will be created using the no-arg constructor.
*/
public PrintArgs() {
}
public String exec(ITestExecutionServices tes, String[] args) {
try {
FileWriter outFile = new FileWriter("C:\\arguments.out");
for (int i = 0; i < args.length; i++)
outFile.write("Argument " + i + " is: " + args[i] + "\n");
outFile.close();
} catch (IOException e) {
tes.getTestLogManager().reportMessage(
"Unable to write to C:\\arguments.out");
}
return null;
}
}