NetworkSuite.WaitForState Method

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

Description

The WaitForState method delays script execution until the network suite in the current project reaches the specified state, unless a specified time limit is reached first.

Declaration

NetworkSuite.WaitForState(StateWaitTime)

State [in]    Required    Integer    
WaitTime [in]    Optional    Integer Default value: 0   
Result Boolean

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

State

Specifies the network suite’s state to be waited for. Read the Network Suite States topic to learn about available network suite states.

WaitTime

Sets the time limit in milliseconds. 0 means indefinite time limit.

Result Value

True if the expected state is reached, and False otherwise.

Remarks

Use the NetworkSuite.State property in order to simply check the state of the Network Suite in the current project.

Example

The following script halts the network suite’s execution if it does not stop on its own for a specified period.

JavaScript, JScript

if (! NetworkSuite.WaitForState(ns_Idle, 600000))
  NetworkSuite.Stop();

Python

if not NetworkSuite.WaitForState(ns_Idle, 600000):
  NetworkSuite.Stop()

VBScript

If Not NetworkSuite.WaitForState(ns_Idle, 600000) Then
  NetworkSuite.Stop
End If

DelphiScript

if not NetworkSuite.WaitForState(ns_Idle, 600000) then
  NetworkSuite.Stop;

C++Script, C#Script

if (! NetworkSuite["WaitForState"](ns_Idle, 600000))
  NetworkSuite["Stop"]();

See Also

Distributed Testing
OnNetSuiteStateChange Event
WaitForNetVarChange Method
State Property

Highlight search results