Forum Discussion

Rakeshyadav09's avatar
Rakeshyadav09
Occasional Contributor
8 months ago

TestComplete Test Run On Azure DevOps - Passing Additional Command Line Parameters in Yaml

# Variable 'BuildNameforReport' was defined in the Variables tab
# Variable 'PipelineStartTime' was defined in the Variables tab
# Variable 'TypeofBuild' was defined in the Variables tab
variables:
- name: timestamp
  value: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')
- name: buildType
  value: "RC"
jobs:
- job: Job_2
  displayName: Install Build
  timeoutInMinutes: 240
  pool:
    name: RXY Testing Pool
  steps:
  - checkout: self
    clean: true
    fetchTags: false
- job: Job_4
  displayName: Sanity Test
  timeoutInMinutes: 240
  dependsOn: Job_2
  pool:
    name: RXY Testing Pool
  steps:
  - checkout: self
    clean: true
    fetchTags: false

  - task: PowerShell@2
    displayName: Set Timestamp and Build Type
    continueOnError: True
    inputs:
      targetType: inline
      buildType: "$(buildType)"     
  - task: VisualStudioTestPlatformInstaller@1
    displayName: Visual Studio Test Platform Installer
    continueOnError: True
  - task: SmartBearSoftware.install-testcomplete-adapter-task.install-testcomplete-adapter-task.InstallTestCompleteAdapter@1
    displayName: TestComplete test adapter installer
    continueOnError: True
    inputs:
      installExecutor: false
      updateExecutor: false
      accessKey: xxxxxx
      cmdLineParams: '/PrjVar:buildType="RC"'
  - task: VSTest@2
    displayName: 1D Sanity Tests
    continueOnError: True
    inputs:
      testAssemblyVer2: '**\test.pjs'
      testFiltercriteria: 1D Sanity Test
      vsTestVersion: toolsInstaller
  - task: VSTest@3
    displayName: 2D Sanity Tests
    continueOnError: True
    condition: eq(variables['2D Sanity Test'], 'True') 
    inputs:
      testAssemblyVer2: '**\test.pjs'
      testFiltercriteria: 2D Sanity Test
      vsTestVersion: toolsInstaller

For the above Yaml, how can I pass additional parameters that I can grab in a test run using BuiltIn.Parameter(0)

I tried multiple formats but i am unable to get this in testcomplete run.

Please suggest.

  • JOHNSMITH167's avatar
    JOHNSMITH167
    Occasional Contributor

    To pass additional parameters for TestComplete using YAML in Azure DevOps, consider modifying your existing YAML file. Add a command line parameter directly in the task where you run TestComplete. Here's an example modification:

    ```yaml
    - task: VSTest@2
      displayName: 1D Sanity Tests
      continueOnError: True
      inputs:
        testAssemblyVer2: '**\test.pjs'
        testFiltercriteria: 1D Sanity Test
        vsTestVersion: toolsInstaller
        runSettingsFile: '$(System.DefaultWorkingDirectory)/path/to/runsettingsfile.runsettings'
    ```

    Create a `runsettings` file (e.g., `runsettingsfile.runsettings`) and specify your parameters:

    ```xml
    <?xml version="1.0" encoding="utf-8"?>
    <RunSettings>
      <TestRunParameters>
        <Parameter name="BuildType" value="$(BuildType)" />
        <!-- Add other parameters as needed -->
      </TestRunParameters>
    </RunSettings>
    ```

    Now, in your TestComplete script, you should be able to access these parameters using `BuiltIn.Parameter(0)` (or the appropriate index).

    Adjust paths and parameter names based on your project structure and requirements. This approach allows you to pass parameters directly to TestComplete using the VSTest task's `runSettingsFile` input.# studding outlet flanges