This enables you to run test assets that are available in a project of a HCL OneTest™ Server from a Github action.
-
Create a github repository
-
Create a folder named ".github/workflows" in the root of the repository
-
Create a .yml file with any name inside the ".github/workflows" folder
-
Then you need to code thta yml file as mentioned in the following example.
name: HCL OneTest Server on: workflow_dispatch: inputs: serverUrl: description: 'Server URL' required: true offlineToken: description: 'Offline Token' required: true teamspace: description: 'Team Space Name' required: true project: description: 'Project' required: true branch: description: 'Branch' required: true assetId: description: 'AssetID' required: true environment: description: 'API Test Environment' required: false datasets: description: 'Datasets' required: false exportReport: description: 'Export Junit Report' required: false multipleValues: description: 'Multiple Values' required: false jobs: OTS-Action: runs-on: self-hosted name: HCL OneTest Server steps: - name: Execute Test uses: SonaHJ/OTSAction@HCLOneTestServer_03 with: serverUrl: '${{ github.event.inputs.serverUrl }}' offlineToken: '${{ github.event.inputs.offlineToken }}' teamspace: '${{ github.event.inputs.teamspace }}' project: '${{ github.event.inputs.project }}' branch: '${{ github.event.inputs.branch }}' assetId: '${{ github.event.inputs.assetId }}' environment: '${{ github.event.inputs.environment }}' datasets: '${{ github.event.inputs.datasets }}' exportReport: '${{ github.event.inputs.exportReport }}' multipleValues: '${{ github.event.inputs.multipleValues }}'
-
Push it into the main branch
-
To configure agent:
- Go to settings (Repo).
- Select action -> runner.
- Click Create self-hosted runner, follow the download and configure instructions
-
Go to the Actions section in the repository and select the workflow.
-
Click the Run workflow dropdown and the list of input text boxes are displayed.
-
After entering the input values click on run workflow button
URL of the HCL OneTest Server where the tests are located. URL should be of the format - https://hostname
Required Input the offline user token for the corresponding HCL OneTest Server
Required Team Space name of the project.
Required Project name of the test.
Required Project name of the test.
Required AssetId of the test file in HCL OneTest Server.
Optional. Test environment corresponding to the test. Mandatory to input the value if you want to run API test.
Optional. Semicolon (;) delimited list of source:replacement datasets for the job to run. For example, dataset1:dataset2;dataset3:dataset4
Optional. Use this option to export the Junit report generated for the test in XML format. Specify the complete path to the directory including the filename. For example, C:/TestFolder/TestFile.xml
You may only define up to 10 inputs for a workflow_dispatch event. Remaining inputs need to be Key=Value pair.
https://github.community/t/you-may-only-define-up-to-10-inputs-for-a-workflow-dispatch-event/160733
Specify the below inputs in the Key=Value format. Ex: variables=sampleVariable|tags=sampleTag
Note that separator between the key-value pairs is '|' character.
Optional. Variables corresponding to the test. The format is variables=sampleVariable
Optional. Variables corresponding to the test. The format is tags=sampleTag