silk central parameters through qtp

145 views Asked by At

I am looking to fetch the results folder from silk central so that I can place my qtp results in the same folder and thereby upload them to silk central. I know that the parameter #sctm_test_results_dir can be used in Java with System.getproperty and it works if my test is a Silk4J test. I have an executable jar file with steps to zip the results and place in the #sctm_test_results_dir directory and I call this JAR file from QTP. But the value returned for the results dir is null. It works fine if I try it as a keyword driven silk4j test though. Any help is appreciated.

The below code is the JAR file which I call from QTP using

Systemutil.Run "cmd",""/K "&str01,"" 

... where str01 is:

"cd c:\ "&chr(38)&chr(38)&chr(32)&"java -jar " &chr(34) & JarFilePath & chr(34) & chr(32) & SrcPath 

JAR file :

String Destpath=System.getenv("#sctm_test_results_dir"); 
// ^ returns null 
System.out.println("Sourcepath :"+Sourcepath); 
System.out.println("DestinationPath :"+Destpath); 
zip_pack(Sourcepath,Destpath+"\\test_z001.zip"); 
// ^ function to zip contents 
System.out.println("Zip complete");`

Thanks!

1

There are 1 answers

0
Roland On

Use a test or execution parameter like SCResultDir and give it the value ${#sctm_test_results_dir}. This will be replaced during execution with the real result directory.

In QTP/UFT create a test input parameter with the same name (parameters starting with # do not work in UFT).

To use it now in some action just create an action input parameter and assign it to this test parameter in the action call properties. Then you can use it in this action as parameter for whatever you need it. Just did it this way and worked fine for me (displayed it in notebook).