Created On:  16 November 2011

Problem:

Is it possible to automatically upload SilkTest files to SilkCentral Test Manager using the Open Agent?

Resolution:

For each execution Test Manager creates a new temporary result directory at the following locations:

for NT-based O/S (Windows XP etc.)
C:\documents and settings\user_name\LOCALS~1\Temp\SCC_ExecServer_19124_19125\PerfProjects

for Vista-based O/S (Windows 7 etc.)
C:\Users\username\AppData\Local\Temp\SCC_ExecServer_19124_19125\PerfProjects

At the end of the test, every file in this directory will be included in the result file list of that execution result. It is possible to use the SilkTest SYS_GetDir () function in order to return the working folder at the time of execution with one caveat: if used with the Open Agent, SYS_GetDir() will always return the name of the Open Agent's own folder. To get around this problem we need to call the Classic Agent, place the current folder name into a global variable and then call the Open Agent. The best place for this is in TestCaseEnter() as it will be called for every script that is run.

[ ] // Global for current temporary execution folder
[ ] string sCurrentDir =""
[ ]
[-] TestCaseEnter()
  [ ] HMACHINE hTarget=GetMachine()
  [ ] string sName = GetMachineName (hTarget)
  [ ] Connect (sName,CLASSIC_AGENT)
  [ ] sCurrentDir = SYS_GetDir ()
  [ ] // print(sCurrentDir)    // Debug line if needed
  [ ] Disconnect(hTarget)
  [ ] Connect (sName,OPEN_AGENT)

Once you have sCurrentDir you can then use this variable to ensure that any files created during the course of the test have their path set to the temporary execution folder.

Incident #2545697