Applies to TestComplete 14.70, last modified on October 20, 2020

Description

Use the RunTestByName method to execute the specified test. This can be any element that TestComplete can execute: a keyword test, a script routine, a low-level procedure, a network suite, and so on. The method does not pause the program’s execution until the test item’s execution is over. It returns immediately after the test run started. If the method cannot initiate the test run, an error occurs. You can handle it using the means provided by the scripting language (see Handling Exceptions in Scripts).

Declaration

IntegrationObj.RunTestByName(ProjectNameTestName)

IntegrationObj An expression, variable or parameter that specifies a reference to an Integration object
ProjectName [in]    Required    String    
TestName [in]    Required    String    
Result None

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

ProjectName

Specifies the name of the project to which the desired test belongs.

TestName

Specifies the full name of the test to be executed.

The full name of a test includes the test name, the name of the parent project item and, for scripts, the name of the unit, which are separated by the pipe character ( | ). For example:

  • "KeywordTests|Test1"
  • "Script|Unit1|Main"
  • Scenarios|Feature1|First line of the scenario description
  • Scenarios|Feature1
  • Scenarios|@tag1
  • "LLCollection1|LLP1"

The full name of a test should not contain the name of any logical project folder.

Result Value

None.

Remarks

Only call this method if TestComplete is not running any tests. Else, an error will occur. To check whether TestComplete is running tests, use the IsRunning property.

RunTestByName returns immediately after the test run has started or if it has failed to start. The method does not pause the program execution until the test run is over. To wait until the test run finishes, you can call the IsRunning property in a loop. See Working With TestComplete via COM - Overview for more information.

See Also

Working With TestComplete via COM - Overview
RunProjectSuite Method
RunProject Method
RunProjectItem Method
RunRoutine Method
RunRoutineEx Method
Halt Method
Stop Method
GetLastResultDescription Method

Highlight search results