Accessing HCL OneTest™ Server
Prerequisites
- You must have installed and configured HCL OneTest™ Server. For more information about HCL OneTest™ Server, see Accessing test assets from a server project.
- Optionally, if you are retrieving secrets, then you must have set up your project on HCL OneTest™ Server and created a secrets collection containing secrets in that project.
- You must have logged in to HCL OneTest™ Server and copied the offline user token generated by using the Offline Token option from the HCL OneTest™ Server Header. See Generating an offline user token. You must have retained the token copy because this offline user token is used to access HCL OneTest™ Server.
Generating an offline user token
- Log into HCL OneTest™ Server.
- Click the icon in the HCL OneTest™ Server Header and click the Offline Tokens option.
- Click Create Token.
- Click within the token field to copy the offline user token to the clipboard.You can paste the copied offline user token in a text document to use the offline user token at a later time.
Using the offline token
The offline user token enables you to connect to HCL OneTest™ Server from HCL OneTest™ API.
- Configure HCL OneTest™ API to publish test reports to HCL OneTest™ Server.
- Access secrets configured in a HCL OneTest™ Server project across different testing environments and during test execution runtime.
You can paste the generated offline user token in the HCL OneTest™ API UI. See Accessing HCL OneTest Server from HCL OneTest API.
Locating the used offline token
The offline user token that you generated and copied from HCL OneTest™ Server and used in the HCL OneTest™ API UI is stored in the .userProfile file. The token is stored under the attribute server.securityToken with the generated offline user token as its value.
The .userProfile file can be found in the .integrationtester subdirectory of the User's home directory. For example, the path to the .userProfile file can be C:\Users\<CurrentUser>\.integrationtester.
Offline user token environment variable
- In the .userProfile file (by setting the value in the Server Settings tab or Project Preferences option in HCL OneTest™ API as detailed in Accessing HCL OneTest Server from HCL OneTest API.
- By setting the value of an OS environment variable (RTCP_OFFLINE_TOKEN=<generated offline user token>)
When running test resources in the HCL OneTest™ API UI, the offline user token defined in the .userProfile file is used to access HCL OneTest™ Server. If there is no token configured in the .userProfile file, then the token in the RTCP_OFFLINE_TOKEN variable is used.
When running test resources in the non-GUI methods, the value of the RTCP_OFFLINE_TOKEN variable is used in preference to the token found in the .userProfile file.
Accessing HCL OneTest™ Server from HCL OneTest™ API
You can access HCL OneTest™ Server from HCL OneTest™ API so that you can retrieve the secrets configured for a project and stored on the HCL OneTest™ Server or to publish test reports from HCL OneTest™ API to HCL OneTest™ Server.
Before you begin
Before you use HCL OneTest™ API to access HCL OneTest™ Server, certain tasks must be completed. See Prerequisites.
About this task
After you have generated an offline user token in HCL OneTest™ Server, you must configure HCL OneTest™ API to access HCL OneTest™ Server.
Procedure
- Open your project. From the HCL OneTest™ API window, click Browse to browse to the location of your project, select the project, and click OK.
-
Open the Server Settings tab from . In the Server Settings tab window, complete the following
steps:
-
Click Server Settings window, complete the following
steps:
. In the Note: You can add the offline user token using this option to enable the access to HCL OneTest™ Server in methods that require an offline user token, for example, when running tests from the command-line client.
- Click the Show server URL validation failed dialog check box.
- Paste the offline user token in the HCL OneTest™ Server Offline Token field.
- Click Apply and then click OK to apply, save, and exit from the dialog.
Note: If you have added the HCL OneTest™ Server offline user token by using the Project Settings option, the same token is displayed in the Preferences for the Server Settings.You can view the offline user token that you added, which gets stored in the .userProfile file located in .integrationtester subdirectory of the User's home directory. For more information, see Locating the used offline token.
Results
You have configured HCL OneTest™ API to access HCL OneTest™ Server.
What to do next
You can retrieve the secrets created and stored in a secret collection on HCL OneTest™ Server from HCL OneTest™ API. For instructions, see Retrieving secrets from HCL OneTest Server.
Accessing HCL OneTest™ Server from IntegrationTesterCmd, ANT CLI, Maven CLI, or in a REST API call
Before you begin
Before you can access HCL OneTest™ Server, certain tasks must be completed. See Prerequisites.
You must have configured the offline user token environment variable. See Offline user token environment variable.
About this task
- The value of the RTCP_OFFLINE_TOKEN variable is used in preference to the token found
in the .userProfile file. Note: In a REST API call, the engine uses the token configured on the agent.
- If you have copied the offline user token generated from HCL OneTest™ Server in the HCL OneTest™ API UI and the copied offline user token resides in the .userProfile file, then the test engine uses the offline token that is available in the .userProfile file. For more information, see Locating the used offline token.
Enabling tests to retrieve the configured secrets
Retrieving secrets during Tests running from command line, ANT CLI, Maven CLI, or as REST API calls provides the parameter or attributes that you may use to retrieve secrets when you are running tests from the command line, ANT CLI, or as REST API calls.
To retrieve secrets from HCL OneTest™ Server | Parameter or attribute to use |
---|---|
When using the HCL OneTest™ API command line or Maven CLI |
Use -secrets as a parameter in your command argument. When you use the RunTests command with this parameter, the secrets collection name defined by the environment is overridden and the secrets defined in the project secrets collection on HCL OneTest™ Server is retrieved. For details, see Run tests by using the command line. |
When running as an ANT task |
Use secrets as an attribute when you are defining an Ant task for running a test. For details, see Run tests by using an Ant task. |
Starting stubs
Retrieving secrets during Tests running from command line, ANT CLI, Maven CLI, or as REST API calls provides the parameter or attributes that you may use when you are starting stubs from the command line, ANT CLI, or as REST API calls.
When starting a stub from the HCL Quality Server by using the start stub command, you may override the token that is used by the agent by specifying the token by using the parameter or attribute indicated in the following table.
Starting a stub | Parameter or attribute to use |
---|---|
When using the HCL OneTest™ API command line |
Use --secretsAuthorization parameter in the start stub command. For details, see Start a stub by using the command line. |
When running as an ANT task |
Use secretsAuthorization attribute in the start stub command. For details, see Start a stub by using an Ant task. |
When running as a REST API call |
Use x-secrets-authorization header in the request. |