Knowledge Base Article

Code for Tracking Tested App Info On Start Test.



I like to know the information about the tested app each test ran on so I wrote up a little code and put it in the OnStartTest Test Engine Event.




This will run every time I run a test telling me the tested app info.  This is wonderful for tracking one off test runs and which app version a test passed on and which it failed on.




function EventControl_OnStartTest(Sender)
    Log.AppendFolder("< EventControl_OnStartTest >");
      Log.AppendFolder("Version Information");
        var FileName = "C:\\Program Files (x86)\\Some Folder\\TestedApp.exe";
        var VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo;
        var FileInf = aqFileSystem.GetFileInfo(FileName);
        var HostName = Sys.HostName;
        var dtObj; 
        Log.Message("File Name: " + FileInf.Name);
        Log.Message("File Version: " + VerInfo.FileMajorVersion + "." + VerInfo.FileMinorVersion + "." + VerInfo.FileBuildVersion + "." + VerInfo.FileRevisionVersion);
        dtObj = new Date(FileInf.DateLastModified);
        Log.Message("File Date: " + FileInf.DateLastModified);
        Log.Message("Host Name: " + HostName);
    Process.Halt("Exception: EventControl_OnStartTest - " + err.message);  //Stop Test Run.
Published 3 years ago
Version 1.0

Was this article helpful?

No CommentsBe the first to comment