TestPartner provides the functionality to execute Visual Tests and Test Scripts via the command line. For more information on how to do this please refer to the TestPartner help topic "Playing Back a Visual Test or Test Script From the Command Line". Users are required to provide command line parameters with the "tp" command in order to specify the test that is to be executed and the credentials required in order to allow this to be done successfully.

Users can take advantage of this functionality from within SilkTest Classic and call the command line via the SYS_Execute function. By using SYS_Execute, SilkTest will wait until the TestPartner.exe process has stopped before returning control back to SilkTest.

The following example is a function that accepts the required string values that will allow TestPartner and the test to be invoked via the command line, it also takes a Boolean value, the value of this determines whether to use the -s parameter for a test script or the -t parameter for a visual test.

[-] testcase CallingTestPartnerExample () appstate none
 [ ] InvokeTestPartner("testingnotepad", "common", "TestPartnerDSN", "admin", "admin", FALSE )
 [ ]

[-] InvokeTestPartner (string sTest, string sProject, string sDSN, string sTPUser, string sTPPassword, boolean bIsVisualTest)
 [ ] BOOLEAN bFileNotFound = FALSE
 [ ] LIST OF STRING lsOutput
 [ ] string s1
 [ ]
 [ ]
 [-] if bIsVisualTest == TRUE
  [ ] // execute as visual test
  [ ] SYS_Execute("tp -u {sTPUser} -p {sTPPassword} -d {sDSN} -r {sProject} -t {sTest}", lsOutput
 [-] else
  [ ] // execute as test script
  [ ] SYS_Execute("tp -u {sTPUser} -p {sTPPassword} -d {sDSN} -r {sProject} -s {sTest}", lsOutput)
  [ ]
 [ ]
 [ ] // check to see if there was no test found
 [-] for each s1 in lsOutput
  [-] if MatchStr("*ERROR*", s1)
   [ ] bFileNotFound = TRUE
   [ ] break
 [ ]
 [-] if bFileNotFound
  [ ] Print("SilkTest encountered an error calling the TestPartner Test")
  [ ] Print("The command line output is: ")
  [ ] ListPrint(lsOutput)