Run Scripts

Applies to TestComplete 14.61, last modified on April 22, 2021

This topic describes how you can execute your script tests.

Run as test items

  1. Open the Test Items page of your project.

  2. Add your script to the list of the project’s test items in one of the following ways:

    • Click New Test Item, then click the ellipsis button in the Execution entity of the added item and select your script in the resulting dialog.

    • Drag the unit that contains your script from the Project Explorer to the Test Items page.

    • Drag you script from the Code Explorer panel (hidden by default).

  3. Run the added test item or run the entire project (see Running Test Items). TestComplete will execute your script.

Run by tag or by tag expression

By one tag from the UI

  1. Assign tags to your script. Tags.

  2. Right-click your project in the Project Explorer and then click Run > Run  @<Tag_Name>.

TestComplete will execute all the tests that match the selected tag.

By tag or by tag expression from Test Items

  1. Assign tags to your script. See Tags.

  2. Open the Test Items page of your project.

  3. Click New Test Item to add a test item to the test run sequence.

  4. In the Execution entity column, click the ellipsis button. In the resulting Select Test dialog, in the Available Tests list, select the needed tag or select [Tag Expression].

    Click OK to close the dialog.

  5. If you have selected [Tag Expression], click the ellipsis button in the Parameters column and specify the needed expression in the Test Parameters dialog.

    Close the dialog.

When you run your project or when you run the created test item, TestComplete will execute all the tests that match the specified tag or tag expression.

Run from Code Editor

Right-click anywhere within the script code and then click Run This Routine.

You cannot run a script in the described manner if it has parameters. To learn how to parameterize scripts, see Parameterizing Script Routines.

Run from other tests

From scripts

Call your script from another script function or procedure.

To call a script declared in another unit, first import that unit. See Calling Routines.

From keyword tests

  1. Add the Run Script Routine or the Run Test operation to your keyword test.

  2. Select your script in the resulting Select Test dialog.

  3. If your script test takes parameters, specify parameter values in the resulting dialog.

Run your keyword test. It will execute the specified script.

See Also

About Script Tests
Running Tests

Highlight search results