Contributions
Get VB Script Unit Name from Distributed Testing setup
Hi, I am currently running distributed tests with the following hierarchy Individual VB Scripts with a list of sub routines A Driver VB Script which runs all the sub routines from 1. A Job which contains a Task to run the Driver VB Script This Job is then added to the project explorer as a test item A Scheduled Task runs the Project I have a function that will output the CPU & Memory usage for 2 exes as to a csv file. I want to call this function from each individual sub routine (in 1. above) as i want output the CPU & Mem usage. I have tried the "Project.TestItems.Current.ElementToBeRun.Caption" but with no luck. I get : VBScript runtime error. Object required: 'Project.TestItems.Current' My code is below. My question is how can i get down to unit level in order to get the sub routine name to log to the file. Sub CPU_Mem_Usage Dim VerFileName, VerInfo, TestItems, tName VerFileName = "\\MyPC1\c\program files\MyExe\MyExe.exe" Set VerInfo = aqFileSystem.GetFileInfo(VerFileName).VersionInfo sFolder = "\\Server1\TestComplete\FutaTill\Results\" aqFileSystem.CreateFolder(sFolder) sPath = sFolder & "\Build_"&VerInfo.FileFullVersion&"\Build_"&VerInfo.FileFullVersion&".csv" tName = Project.TestItems.Current.ElementToBeRun.Caption If Not aqFile.Exists(sPath) Then Call aqFile.Create(sPath) Call aqFile.WriteToTextFile(sPath, "CPU & Memory Usage Statistics for My Exe Build Version " & VerInfo & vbCrlf , aqFile.ctANSI, False) Call aqFile.WriteToTextFile(sPath, "Test Date & Time: " & aqDateTime.Now & vbCrlf , aqFile.ctANSI, False) Call aqFile.WriteToTextFile(sPath, "" & vbCrlf , aqFile.ctANSI, False) Call aqFile.WriteToTextFile(sPath, "Time, Script Name,,,,,,,MyExe, CPU (%), Mem Usage (K),, MyExe2, CPU (%), Mem Usage (K)" & vbCrlf , aqFile.ctANSI, False) Call aqFile.WriteToTextFile(sPath, "*****************************************************************************************************************************************" & vbCrlf , aqFile.ctANSI, False) End If Call aqFile.WriteToTextFile(sPath, aqDateTime.Time & "," & tName & ",,,,,,,," & Sys.Process("MyExe").CPUUsage & "," & Sys.Process("MyExe").MemUsage & "," & ",," & Sys.Process("MyExe2").CPUUsage & "," & Sys.Process("MyExe2").MemUsage & vbCrlf , aqFile.ctANSI, False) End Sub All help greatly appreciated Thanks, JimmySolved949Views0likes1Comment- 1.4KViews0likes0Comments
Get Exe version number from Host
Hi All, Currently working on a distributed setup where I have a server that runs test execute at a scheduled time to execute the project suite. The project suite includes a list of jobs that are run accross a couple of Hosts. At the end of the test run, I am saving the results file to a location & renaming it with the version\build of the exe run on the host(s). I have tried using the Sys.Process.FileVersionInfo (see code below) but this wont work because the exe (MyExe.exe) is not present on the Server where the test run is kicked off. Therefore I get errors that the process was not found. I have also investigated using various variables (Project, ProjectSuite & NetworkSuite) but these dont seem to work for me either. Sub LogFinalResultsAndEmail 'This Routine will Export the Results Log to the Folder below & will also Rename the log to the build version. 'It will then email these Results to the specified email addresses. sFolder = "\\Server1\TestComplete\Project1\Results\" aqFileSystem.CreateFolder(sFolder) FileName = sFolder & "\Build_" &Sys.Process("MyExe").FileVersionInfo & "\MyExe_Build_"& Sys.Process("MyExe").FileVersionInfo & "_" & Sys.HostName & ".mht" Log.SaveResultsAs FileName, 2 Call SendEmail ("relay@email.com", "myemail@email.com","Test Results: MyExe Build Version "& Sys.Process("MyExe").FileVersionInfo,"Full Test Results for MyExe Build Version "& Sys.Process("MyExe").FileVersionInfo& " are available by clicking the following link. The results file (.mht) opens in Internet Explorer. " & "<a href="&FileName&"> Test Results</a> "&". Please do not reply to this message. This email is an automated notification, which is unable to receive replies.") End Sub So my question is how can I get access to the exe version details from the remote host in order to name the results file accordingly. Any help greatly appreciated. Thanks, JimmySolved1.5KViews0likes4CommentsOutput the VBScript Unit Name to File
I am currently writing a VBScript function that outputs the CPU% & Memory Usage of two applications that run simultaneously. I have achieved this & I get the data to in csv format. I have a set of VB Scripts that run as part of my project & I have amended them to call the function above in order to output the CPU & Memory Usage. What I want to achieve is that when my function is called, I can also output the Script Unit name (or even better the actual sub routine within the script that has been run). This will then allow me to accurately monitor individual areas of my applications for any possible memory leaks etc. Any Ideas?? Below is my code so far. Sub CPU_Mem_Usage 'This routine will monitor the CPU & the Mem Usage & outputs the result to a CSV file with the build version as the file name. Dim sPath sPath = "\\Ulysses2008\TestComplete\FutaTill\TestProject_FT\Results\FutaTill_CPU_Mem_Stats_"&_ Sys.Process("FutaTill").FileVersionInfo & ".csv" If Not aqFile.Exists(sPath) Then Call aqFile.Create(sPath) Call aqFile.WriteToTextFile(sPath, "CPU & Memory Usage Statistics for FutaTill Build Version " &_ Sys.Process("FutaTill").FileVersionInfo & vbCrlf , aqFile.ctANSI, False) Call aqFile.WriteToTextFile(sPath, "Test Date & Time: " & aqDateTime.Now & vbCrlf , aqFile.ctANSI, False) Call aqFile.WriteToTextFile(sPath, "FutaTill, CPU (%), Mem Usage (K),, WinEpos, CPU (%), Mem Usage (K)" &_ vbCrlf , aqFile.ctANSI, False) End If Call aqFile.WriteToTextFile(sPath, "," & Sys.Process("FutaTill").CPUUsage & "," & Sys.Process("FutaTill").MemUsage &_ "," & ",," & Sys.Process("wineposv4").CPUUsage & "," & Sys.Process("wineposv4").MemUsage & vbCrlf , aqFile.ctANSI, False) End Sub1.9KViews0likes1Comment