Stop a stub by using the command line

You can stop all instances of a stub by using the HCL OneTest API command line. This option is useful in situations where Ant is not available.

The syntax to use is as follows:
IntegrationTesterCmd Options stop-stub
Here is an example syntax of synchronous mode, where there is only one stub in the environment, and it only has one version:
IntegrationTesterCmd --serverUrl "https://Host name or IP address:5443/RTCP"
 --domain <Domain name> --environment <Environment name>
 --name <Stub name> stop-stub
Here is an example syntax of asynchronous mode, where component and operation are used to precisely identify a stub, a specific version is specified, and the user has locked the environment:
IntegrationTesterCmd --serverUrl "https://Host name or IP address:5443/RTCP/" 
--domain <Domain name> --environment <Environment name> 
--component <Component name> --operation <Operation name> 
--name <Stub name> --version <Stub version number> 
--username <User name> --async stop-stub

Managed stubs

Starting from version 10.0.0 or later, you can use the following command to stop a managed stub instance:
IntegrationTesterCmd Options switch-off-stub

For more information about managed stubs, see Server-based stubs.

List of available options lists the options that you can use with the IntegrationTesterCmd command for stopping a stub and List of available options lists the options available for stopping a managed stub.

Table 1. List of available options
Option Description
--serverUrl/-u URL of the HCL Quality Server.
--domain/-d Domain name
--environment/-e Environment name
--component/-c Component the stub exists within (optional).
--operation/-o The operation the stub exists within on the server (optional).
--name/-n The name of the target stub to stop.
--version/-v Version of the target stub to stop (optional).
Note: If you are using HCL OneTest API V9.1.1.1 or later, and the HCL Quality Server command line or Apache Ant tasks are used to stop a stub, and if no stub version information is provided, it is the latest version of a stub with running instances that is stopped. If you are V9.1.1 or earlier, and the HCL Quality Server command line or Apache Ant tasks are used to stop a stub that has multiple versions, and if no stub version information is provided, an error is reported.
--async/-a Run asynchronously; defaults to synchronous (flag).
--username/-l Specify the user name to authenticate with the server if the environment is locked and the domain security is disabled.
--securityToken

Specify the security token generated for you to authenticate with HCL Quality Server when the domain security is enabled. In the locked environment mode, the operation can be performed by the user who locked the environment.

Table 2. List of available options for stopping a managed stub
Options Description
--serverUrl/-u URL of the HCL Quality Server.
--domain/-d Domain name
--environment/-e Environment name
--name/-n The name of the target stub to start.
--id/-i The ID of the target (Optional).
--securityToken

Specify the security token generated for you to authenticate with HCL Quality Server when the domain security is enabled. In the locked environment mode, the operation can be performed by the user who locked the environment.

Error codes

For details of any error codes, see Exit codes for Command-line client and Ant client.