I have configured spec run in my project with custom.srprofile file to add three different targets for configuring three different test environments. I have added configuration transformations to the targets to pick up right URL depending on the environment from app.config app settings like below:
<Targets>
<Target name = "Integration">
<DeploymentTransformationSteps>
<ConfigFileTransformation configFile="app.config">
<Transformation>
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<appSettings>
</appSettings>
</configuration>
]]>
</Transformation>
</ConfigFileTransformation>
</DeploymentTransformationSteps>
</Target>
<Target name = "Staging">
<DeploymentTransformationSteps>
<ConfigFileTransformation configFile="app.config">
<Transformation>
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<appSettings>
<add key="BaseUri" value="
https://STAGINGURL.com/" xdt:Locator="Match(key)" xdt:Transform="SetAttributes(value)" />
</appSettings>
</configuration>
]]>
</Transformation>
</ConfigFileTransformation>
</DeploymentTransformationSteps>
</Target>
<Target name = "PreProduction">
<DeploymentTransformationSteps>
<ConfigFileTransformation configFile="app.config">
<Transformation>
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<appSettings>
<add key="BaseUri" value="
https://PREPRODURL.com" xdt:Locator="Match(key)" xdt:Transform="SetAttributes(value)" />
</appSettings>
</configuration>
]]>
</Transformation>
</ConfigFileTransformation>
</DeploymentTransformationSteps>
</Target>
</Targets>
Now, If I run my tests, my tests are running for all three targets(all environments). Could you please let me know if there is a way I can pass the value to the srprofile file (from team city or from command line or using filter tags or some where) so, it will run tests only for the environment I require?
I am stuck here at the moment and I dont know how to proceed. Your help is much appreciated. Thank You.