Application Delivery Management
Application Modernization & Connectivity
CyberRes by OpenText
IT Operations Management
How do I implement a results parser for the SSH plug-in which will allow an Execution Definition to display a status of passed?
This article will assume that you have been able to import the source of the SSH plug-in into a new Java project for whichever IDE is used to build Java applications and that the existing source compiles correctly. Open the file "SSHTestLaunchBean.java" and add the following function to the class:
//parse the plain text results file which is returned
public void parseResults(File resultsFile, TestLaunchResultDrain pubMessages){
try{
FileReader resFile = new FileReader(resultsFile);
BufferedReader readRes = new BufferedReader(resFile);
String info = "";
while(readRes.ready()){
info = readRes.readLine();
pubMessages.publishMessage(pubMessages.SEVERITY_INFO, info);
}
}
catch(Exception e){
}
}
In the execute function of the class you will find the following section of code:
/* Collect results
*
* Results should be in standard results xml format
*
* See plugin package for sample xml results files
*/
File outputFile = new File(resultsFilePath);
if (outputFile.exists())
{
drain.parseStdResultFile(outputFile);
return true;
}
Replace the following line of code from the above section of code:
drain.parseStdResultFile(outputFile);
with:
parseResults(outputFile, drain);
Compile your project and add the relevant files to a zip file whose contents structure shoud reflect that of the original plug-in. Copy the zip file to the SilkCentral Test Manager "Plugins" directory and restart the SilkCentral Test Manager services via the SilkCentral Service Manager. Your existing SSH Test/Execution Defintions should now execute and show a status of passed. A sample plug-in which uses the code above is attached to this article.
Related documents: |