In your TestComplete projects you run as part of your pipeline or test plan, you may have tests that take environment data as input parameters. For example, you may have a test that takes the URL of your tested web application or the path to the test desktop application as an input parameter. When you run your pipeline or your test plan, you may want to pass these parameters to your TestComplete tests.
By default, the Visual Studio Test task cannot pass pipeline variables and task environment variables to TestComplete tests it runs via TestComplete test adapter, directly. There are several workarounds you can take:
Pass environment variable values as custom attributes
You can configure the Enable support for TestComplete tests task to start TestComplete (or TestExecute) on your agents with extra command-line parameters. You can use this to pass environment variables values to your TestComplete tests:
Add the Enable support for TestComplete tests task to your pipeline.
Note: If the task is not available, make sure that you have the TestComplete Test Adapter extension installed on your server. See Install TestComplete Test Adapter Extension.
Configure the task to pass pipeline variables and local task variables to your TestComplete tests. To do this, you can use:
In your TestComplete test project, create a script routine (or a keyword test) that will get the project or project suite variables or values from the custom command-line parameters, and send them to your tests.
Store environment variable values to a file
In your Team project, create a file that will store all needed parameter values.
Place the file to a location where your TestComplete tests will be able to access it. For example, you can place the file to a repository and then configure your pipeline to place it to your test machine.
Configure your pipeline to store parameter values to the file. You can do it, for example, by using the PowerShell script task or the Command line task:
In your TestComplete test project, create a script routine (or a keyword test) that will get the needed values from the file and pass them to your tests. For detailed information on how to read data from files in TestComplete, see Working With External Data Sources.