A test project contains tests of various types: scripts, keyword tests, low-level procedures and so on. Each test has a name. For script routines, this is the routine’s name, for keyword tests, low-level procedures and other types of tests this is the name of the appropriate project element in the Project Explorer panel. This topic describes how to run tests by their name.
Run as a test item
-
Select your project in the Project Explorer panel and then select View > Organize Tests from the TestComplete main menu. This will open the Execution Plan editor of the project.
-
Click New Item to add a new test item to the project.
-
Click the ellipsis button within the Test cell of the new test item and choose the test to be run from the resulting Select Test dialog.
Now, when you run your project, the test item will run the specified tests.
Run from keyword tests
From a keyword test, you can run script routines, low-level procedures and even other keyword tests:
-
Open your keyword test for editing.
-
Add the Run Test, Run Script Routine or Run Keyword Test operation to the test.
TestComplete will display the Operation Parameters dialog where you can specify the name of the desired test and the test’s parameters (if any).
Now, when you run your project, the test item will run the specified tests.
Run from scripts
The way you run tests from scripts depends on the test type:
-
Each script test is a procedure or function written in VBScript, JavaScript, JScript, Python, DelphiScript, C++Script or C#Script. You can run this procedure or function from another script test simply by calling it.
JavaScript, JScript
function TestRoutine1()
{
...
TestRoutine2(Param1, Param2);
...
}Python
def TestRoutine1(): ... TestRoutine2(Param1, Param2) ...
VBScript
Sub TestRoutine1
...
Call TestRoutine2(Param1, Param2)
...
End SubDelphiScript
procedure TestRoutine1;
begin
...
TestRoutine2(Param1, Param2);
...
end;C++Script, C#Script
function TestRoutine1()
{
...
TestRoutine2(Param1, Param2);
...
}You can also call routines defined in another script unit or project. See Calling Routines.
-
To run other tests, you use special program objects:
-
To run a keyword test, use the
KeywordTests.KeywordTestName.Run
method. -
To run a low-level procedure, use the
LLCollection.LLProcedure.Execute
method. -
To run a unit test or Selenium, use the
Unit_Testing_Colleciton_Name.Test_Name.Execute
method. -
To run a ReadyAPI test, use the
ReadyAPI_Collection_Name.Test_Name.Execute
method.
For detailed information on running tests from scripts, follow these links:
-