Start a stub by using an Ant task

You can start a stub by using the HCL DevOps Test Virtualization Control Panel (Test Virtualization Control Panel) Ant tasks.

Here is an example syntax:
<taskdef name="startStub" classname="com.ghc.ghTester.ant.StartStub" classpathref="tasklib" />

<startStub domain="<Domain name>" environment="<Environment name>" component="<Component name>" 
operation="<Operation name>" name="<Stub name>" version="<Stub version number>" 
serverUrl="https://<Hostname or IP address>:5443/RTCP/"/>
The following table lists the attributes that you can use with the startStub Ant task for starting a stub.
Table 1. List of available attributes
Attribute Description Required
async Run asynchronously (flag). No, default option is synchronous.
attributes Comma-separated list of agent attributes identifying the agent to run on. No
component Component the stub exists within. No
dedicatedEngine

If you want to run the stub on a dedicated engine, you can also specify the JVM options by using the dedicatedEngineJvmOptions parameter. You can then specify the values for the attributes such as the maximum memory, the initial memory, and the garbage collection policy that must be applied for the dedicated engine.

The JVM options can be specified only if you set this option to "true".
Example:
<taskdef name="startStub" classname="com.ghc.ghTester.ant.StartStub" classpathref="tasklib" />

<startStub domain="default" environment="local" name="ReqRepStub" version="1.0" 
serverUrl="https://localhost:5443/RTCP/" dedicatedEngine="true" 
dedicatedEngineJvmOptions="-Xmx2g -Xms256m -Dmy.option=\"my\ value\"" />
Note:
  • Use spaces to separate the JVM parameters.
  • The quotations and the space in the value must be escaped with a backslash as specified in the example.
No
disablePerformanceOptimisations Specify the value true to disable performance optimization when starting the stub. No
domain Domain name Yes
environment Environment name Yes
failureProperty The name of a property that is set in the event of a failure. No
  • force
  • forceIf
  • forceUnless
Use the force flag or option to start the stub by ignoring any warnings or errors that might occur. You can use any of the following variants:
Option/Flag Action
force Use this flag to ignore all the problems that occur when you start the stub.
forceIf Specify this option along with a space-separated list of problem identifiers that must be ignored when you start a stub.
forceUnless Specify this option along with a space-separated list of problem identifiers that must not be ignored when you start a stub. If the parameter list is empty, the force setting is not considered and none of the errors are ignored.
You can use the following identifiers that must be either ignored or considered when the stub is started:
Parameter Description
agent-criteria-unsatisfied Indicates that there were not enough agents available to run the stub or the specified agents were not found.
reused-agent Indicates that the selected agent is already running that stub. Running multiple instances of that stub at the same time on the same agent does not provide any benefit over running it a single time on that agent.
engine-criteria-unsatisfied Indicates that none of the agents could satisfy the engine requirements to start the stub. This might occur if none of the agents support dedicated stub deployments.
Example:
<startStub ... force="true"/>
<startStub ... forceIf="reused-agent agent-criteria-unsatisfied"/>
<startStub ... forceUnless="engine-criteria-unsatisfied"/>
haltOnFailure Set to true to fail the Ant script if the stub fails to start (flag). No, default is false.
name The name of the target stub to start. Yes
operation The operation the stub exists within on the server. No
secretsAuthorization

User offline token for authorizing the client to access HCL DevOps Test Hub (Test Hub).

For example, the command to start a stub that uses the secretsAuthorization attribute follows:
<startStub ... secretsAuthorization="USER_OFFLINE_TOKEN"/>

For more information, see Accessing Test Hub from IntegrationTesterCmd, ANT CLI, Maven CLI, or in a REST API call.

No
securityToken

Specify the security token generated for you to authenticate with Test Virtualization Control Panel when the domain security is enabled. In the locked environment mode, the operation can be performed by the user who locked the environment.

No, default is to send no token.
serverUrl URL of the Test Virtualization Control Panel. Yes
username Specify the user name to authenticate with Test Virtualization Control Panel if the environment is locked and the domain security is disabled. No
version Version of the target stub to start.
Note: If you are using HCL DevOps Test Integrations and APIs (Test Integrations and APIs) 8.5.0.1 or later, and the Test Virtualization Control Panel command line or Apache Ant tasks are used to start a stub, and if no stub version information is provided, it is the latest version of a stub that is run. If you are using 8.5.0 or earlier, and the Test Virtualization Control Panel command line or Apache Ant tasks are used to start a stub, and if no stub version information is provided, it is the earliest version of a stub that is run.
No
workerThreadCount The amount of worker threads used to service requests to the stub (optional). No

Error codes

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