Created On:  25 May 2012

Problem:

How do you upload additional files to the "Files" section of an Test run result in SilkCentral Test Manager from a SilkTest Classic execution?

Resolution:

The execution server creates a new random temporary folder each time it is run. There are two ways that you can locate this folder; by reading the enviromental variable created by the execution server or by using the Classic Agent to read the current folder. In both cases you then set the folder name into a global variable for use in TestCaseExit().

Global variable for the current folder

[ ] string sCurrentDir=""

Preferred method for both Open Agent and Classic Agent

[-] TestCaseEnter()
 [ ] sCurrentDir=SYS_GetEnv("#sctm_test_results_dir")


Method using the Classic Agent if the rest of the testcase is all Open Agent

[-] TestCaseEnter()
 [ ] HMACHINE hHost
 [ ] HANDLE hAgent
 [ ] STRING sMachine
 [ ] hHost=GetMachine()
 [ ] sMachine=GetMachineName(hHost)
 [ ] hAgent=Connect(sMachine,CLASSIC_AGENT)
 [ ] sCurrentDir=SYS_GetDir()
 [ ] Disconnect(sMachine)

Method for a pure Classic Agent testcase

[-] TestCaseEnter()
 [ ] sCurrentDir=SYS_GetDir()


Copy the files to sCurrentDir on TestCaseExit() and SilkCentral will automatically upload them to the results tab.

[-] TestCaseExit()
 [ ] // code here to copy files to location

Incident #2575263