Preparing TestComplete Tests That Take Parameters for Running in CrossBrowserTesting Environments

Applies to TestComplete 12.60, last modified on September 17, 2018

Script routines and keyword tests in TestComplete can take parameters. When you run such a test, you pass the desired parameters. See Parameterizing Tests.

You cannot assign tests that take parameters to CrossBrowserTesting environments directly.

To run tests that take parameters in CrossBrowserTesting environments anyway, you can do any of the following:

Use Test Items

  1. In an appropriate TestComplete project, create a test item that will run the needed test:

    • Open the needed project in TestComplete.

    • Select View on the TestComplete main menu and then click Organize Tests. TestComplete will open the Test Items page of your project.

    • Click New Test Item on the page toolbar:

      Integration with CrossBrowserTesting.com: Test Items page of the project
    • In the Test column, click the ellipsis button and select the needed test in the resulting dialog:

      Integration with CrossBrowserTesting.com: Adding a test item
  2. Set the test parameters in the Parameters column on the Test Items page:

    Integration with CrossBrowserTesting.com: Setting test item parameters
  3. Add the created test item to the CrossBrowserTesting manager:

    Integration with CrossBrowserTesting.com: Assigning test items to the environment list

When you run tests in CrossBrowserTesting environments, the test items will run the needed tests with the specified parameters.

Create a “Master” Test

  1. Create a script routine or a keyword test that you will use as a “master” test.

  2. Add commands that will run your tests with the desired parameters to the created test:

    • To run a test from a keyword test, you can use the following operations:

      Specify the parameters of the called test in the Operation Parameters dialog of the appropriate operation.

    • To run a keyword test from a script routine, use the KeywordTests.KeywordTest_Name.Run method.

    • To run a script routine from another script routine, call it by its name and pass the needed parameters enclosed in parentheses:

      JavaScript, JScript

      function Test1(Param1, Param2, Param3)
      {
        …
      }

      function Main()
      {
        …
        Test1("Value1", 1, true);
        …
      }

      Python

      def Test1(Param1, Param2, Param3):
        …

      def Main():
        …
        Test1("Value1", 1, true)
        …

      VBScript

      Sub Test1(Param1, Param2, Param3)
        …
      End Sub

      Sub Main
        …
        Call Test1("Value1", 1, True)
        …
      End Sub

      DelphiScript

      procedure Test1(Param1, Param2, Param3);
      begin
        …
      end;

      procedure Main;
      begin
        …
        Test1('Value1', 1, true);
        …
      end;

      C#Script

      function Test1(Param1, Param2, Param3)
      {
        …
      }

      function Main()
      {
        …
        Test1("Value1", 1, true);
        …
      }
  3. Add the created “master” test to the CrossBrowserTesting manager:

    Integration with CrossBrowserTesting.com: Assiging the created master test to the environment list

When you run the tests, the “master” test in CrossBrowserTesting environments will call the needed tests with the specified parameters.

See Also

Preparing for Running Tests in CrossBrowserTesting Environments
Preparing TestComplete Project Suites for Running in CrossBrowserTesting Environments
About CrossBrowserTesting Integration
Running Tests in CrossBrowserTesting Environments

Highlight search results