Forum Discussion

sumitahuja's avatar
sumitahuja
New Contributor
9 months ago
Solved

Issue sending Environment variable to TestComplete via Azure pipeline using command-line Parameters

Hi there,

I'm trying to create an Azure pipeline to send project Environment variable called environment to Test complete to change the testedApp based on the environment variable set in the pipeline.

I've followed the instructions on Pass Environment Variables to TestComplete Tests | TestComplete Documentation (smartbear.com)

But, it doesn't seem to work. Is there any other setting that needs to be done?

 

  • Thank you for your help Smartbear community, 

     

    I've found a solution to send the parameter using command line script and sending the parameter value to a txt file, then setting the value in the txt file as the project variable. It seems to work 

    script: |

          cd $(System.DefaultWorkingDirectory)

          Echo off

          Echo %Environment% > parameters.txt         

        displayName'Command Line Script'

        env:

          Environment${{parameters.Environment}}

6 Replies

    • sumitahuja's avatar
      sumitahuja
      New Contributor

      Hi Marsha, 

      Yeah, I've implemented the solution but nothing happens. The environment variable is not updated

  • jkrolczy's avatar
    jkrolczy
    Regular Contributor

    for /PrjVar:Environment="$(UAT)"
    where in your Azure pipeline side do you have this defined ?
    What values can this be ? 

    Maybe set this to an actual value to test with to determine if syntax is causing an issue ?

    • sumitahuja's avatar
      sumitahuja
      New Contributor

      Hi Jkrolczy,

      where in your Azure pipeline side do you have this defined ?

      I have it defined in the Test Complete project and created a variable and a parameter called Environment to capture the value
      What values can this be ? 

      The value will be passed in by the user when they are running the pipeline to determine which environment to run the script in.

      I had just put a value for now to check whether it get passed into Test Complete project variable

      Maybe set this to an actual value to test with to determine if syntax is causing an issue ?

      UAT is the actual value that will be sent in "Environment" is the parameter name

      • jkrolczy's avatar
        jkrolczy
        Regular Contributor

        I have a 'Command line script 'step in my ADO pipeline

        "C:\Program Files (x86)\SmartBear\TestExecute 15\Bin\TestExecute.exe" "C:\Git.TestManagement\TestManagement\TestComplete\TC15_Version\TestProjSuite\TestProjSuite.pjs" /r /e /SilentMode /DoNotShowLog /p:XClaim /test:"Script|Group_ITPatches4|GroupITPatches4" /PrjVar:NwkENV=PROD


  • sumitahuja's avatar
    sumitahuja
    New Contributor

    Thank you for your help Smartbear community, 

     

    I've found a solution to send the parameter using command line script and sending the parameter value to a txt file, then setting the value in the txt file as the project variable. It seems to work 

    script: |

          cd $(System.DefaultWorkingDirectory)

          Echo off

          Echo %Environment% > parameters.txt         

        displayName'Command Line Script'

        env:

          Environment${{parameters.Environment}}