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
-
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:
-
In the Execution entity column, click the ellipsis button and select the needed test in the resulting dialog:
-
-
Set the test parameters in the Parameters column on the Test Items page:
-
Add the created test item to the CrossBrowserTesting manager:
When you run tests in CrossBrowserTesting environments, the test items will run the needed tests with the specified parameters.
Create a “Master” Test
-
Create a script routine or a keyword test that you will use as a “master” test.
-
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 SubDelphiScript
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);
…
}
-
-
Add the created “master” test to the CrossBrowserTesting manager:
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