Launching Tested Applications on Different Operating Systems

Applies to TestComplete 15.70, last modified on December 17, 2024
Information in this topic applies to desktop applications only.

Task Description

Launch information for your tested application, its executable path, command-line parameters, path to the working folder and so on can be different for different operating systems. To launch your tested application on any operating system successfully, make sure that your test uses launch information appropriate to the operating system, on which it is currently running.

Possible Solution

Use tested application items to store launch information for your application under test. If the application’s launch information must be unique for each operating system on which your application will be tested, you can do one of the following:

  • Specify launch information for your tested applications dynamically in tests. To do that, use the TestedApp scripting object that provides access to items in Tested Applications collection and allows specifying their parameters.

    JavaScript, JScript

    function Test()
    {
      var SampleApp, ProgramFiles, FileName, Path;

      …

      // Obtains the tested application's item
      SampleApp = TestedApps.Items("SampleApp");

      // Specifies the path to the Program Files folder on the current computer
      ProgramFiles = aqEnvironment.GetEnvironmentVariable("ProgramFiles");

      // Specifies the path and the name of the application's executable
      FileName = "SampleApp.exe";
      Path = ProgramFiles + "\\SampleAppFolder\\";

      SampleApp.Path = Path;
      SampleApp.FileName = FileName;

      …

    }

    Python

    def Test():
      
      ...
    
      # Obtains the tested application's item
      SampleApp = TestedApps.Items["SampleApp"];
    
      # Specifies the path to the Program Files folder on the current computer
      ProgramFiles = aqEnvironment.GetEnvironmentVariable("ProgramFiles");
    
      # Specifies the path and the name of the application's executable
      FileName = "SampleApp.exe";
      Path = ProgramFiles + "\\SampleAppFolder\\";
    
      SampleApp.Path = Path;
      SampleApp.FileName = FileName;
    
      ...

    VBScript

    Sub Test
      Dim SampleApp

      …

      ' Obtains the tested application's item
      Set SampleApp = TestedApps.Items("SampleApp")

      ' Specifies the path to the Program Files folder on the current computer
      ProgramFiles = aqEnvironment.GetEnvironmentVariable("ProgramFiles")

      ' Specifies the path and the name of the application's executable
      FileName = "SampleApp.exe"
      Path = ProgramFiles & "\SampleAppFolder\"

      SampleApp.Path = Path
      SampleApp.FileName = FileName

      …

    End Sub

    DelphiScript

    procedure Test();
    var SampleApp, ProgramFiles, FileName, Path;
    begin
      …

      // Obtains the tested application's item
      SampleApp := TestedApps.Items['SampleApp'];

      // Specifies the path to the Program Files folder on the current computer
      ProgramFiles := aqEnvironment.GetEnvironmentVariable('ProgramFiles');

      // Specifies the path and the name of the application executable
      FileName := 'SampleApp.exe';
      Path := ProgramFiles + '\SampleAppFolder\';

      SampleApp.Path := Path;
      SampleApp.FileName := FileName;

      …

    end;

    C++Script, C#Script

    function Test()
    {
      var SampleApp, ProgramFiles, FileName, Path;

      …

      // Obtains the tested application's item
      SampleApp = TestedApps["Items"]("SampleApp");

      // Specifies the path to the Program Files folder on the current computer
      ProgramFiles = aqEnvironment["GetEnvironmentVariable"]("ProgramFiles");

      // Specifies the path and the name of the application's executable
      FileName = "SampleApp.exe";
      Path = ProgramFiles + "\\SampleAppFolder\\";

      SampleApp["Path"] = Path;
      SampleApp["FileName"] = FileName;

      …

    }

  • Create separate items for the same tested application but each with unique launch information.

    For example, your Tested Applications collection can contain the TestedAppWin7 item that stores parameters required for launching your tested application on the Windows 7 operating system and the TestedAppWin10 item that stores parameters for launching your application on Windows 10.

See Also

TestedApp Object
About Tested Applications
Working With Tested Applications in Tests

Highlight search results