Problem:
Currently when you run a TestPartner script through SCTM, the result file gets dynamically copied to a temporary Perfprojects folder (C:\Documents and Settings\\Local Settings\Temp\SCC_ExecServer_19124_19125\PerfProjects) on the Execution server machine. Only files in this directory will get uploaded to the files tab of that execution run in SCTM. See screenshot below:-
Resolution:
SCTM stores the path to the perfprojects directory in an environment variable called #sctm_test_results_dir. You can amend your TestPartner script to save your text file to the "#sctm_test_results_dir" directory. See sample script below:-
Option Explicit
Sub Main()
create_SCTMfile
End Sub
Sub create_SCTMfile()
Dim sPath As String
Dim sFname As String
Dim i As Integer
' Reading and printing path of SCTM environment variable
sPath = Environ("#sctm_test_results_dir")
TestLog.Comment (sPath)
' Creating a text file and saving to above directory for SCTM to read back to files tab of execution run results
sFname = "MyFile.txt"
i = FreeFile
Open sPath & "\" & sFname For Output As #i
Write #i, "Writing a file to SCTM execution results" 'Entering test data in the text file
Close
End Sub
MyFile.txt will then be uploaded to the files section in SCTM after the execution finishes: See screenshot:-