Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override TestRun Parameters with value including semi colons in Visual Studio Team Services

My runsettings file contains few connectionstrings which I want to be able to override in VSTS depending on the environment.

I don't want a specific runsettings file for each environment, but I want to use environment variables in order to be consistent on how our other deployment release are configured.

However I'm facing issue when I want to forward to my unit test a connectionstring (or any parameter) which include a semicolon (;). It's being truncated. I've tested transmitting other value without ";" successfully.

environment variables

task configuration

settings.runsettings

        <?xml version="1.0" encoding="utf-8"?>
        <RunSettings>
          <TestRunParameters>
           <Parameter name="CRM_CONNECTIONSTRING" value="Url = https://MYCRM.crm4.dynamics.com; [email protected]; Password=mypassword;" />
          <TestRunParameters>        
         </RunSettings>

However, when exectuting (and displaying the actual value received in the unit test) the value is truncated after the first ";"

enter image description here

is there a way to protect the value ?

like image 805
camous Avatar asked Sep 15 '16 11:09

camous


1 Answers

ending up to answer to myself with a workaround after contacting microsoft directly.

issue come up as well here on official vsts-task github: https://github.com/Microsoft/vsts-tasks/issues/2567

Workaround: before the test assembly task, run a powershell script taking path to runsettings file as parameter, reading VSTS environment variables and replace direcly XML values in runsettings.

I've provided my powershell script here : https://github.com/camous/vsts-powershell/blob/master/Set-RunSettings.ps1 (parameters have to be prefixed by "__")

and I wrote a more complete "how to" here: https://stuffandtacos.azurewebsites.net/2016/09/28/override-runsettings-parameters-in-visual-studio-team-service-when-value-contains-semi-colons/

like image 115
camous Avatar answered Oct 05 '22 14:10

camous