Ask a Question

Passing a parameter from Azure/devops into TestComplete

Occasional Contributor

Passing a parameter from Azure/devops into TestComplete



i am recently start using TestComplete. I wonder how can I use paramters from a VsTest (e.g. Override Parameters) in order to pass a url from the pipeline into TestComplete as a parameter.


Looking forward to your help!

Champion Level 3

Occasional Contributor

Thanks @Marsha_R  for your reply. If a read the parent item of this article, it says that using TcItem is or will become obsolete.


I would rather use the Test Adapter, but i still dont know how to pass parameters through from azure. 

Occasional Contributor

i found  a solution. 


First, I entered an overriding paramter within the pipeline.

snapshot pipeline.PNG

Then, I found a script to retrieve parameters from the commandline.


function ProcessCommandLine() {
var i;
for (i = 1; i <= BuiltIn.ParamCount(); i++) {

function ProcessCommandLineArgument(arg) {
var items;
items = arg.split("=");
if (items.length != 2) {
switch (aqString.ToLower(aqString.Trim(items[0]))) {
case "env":
Log.Message("The 'env' argument is found! The value is '" +
aqString.Trim(items[1]) + "'");
var url_deployment = items[1];
Project.Variables.url_loginscreen = url_deployment;


now my persistent Variable url_loginscreen is changed and ready to be used with the given parameter from the commandline.


Occasional Contributor

I Thought this would be solved, but VsTest is not allowing me to put in a parameter. So how can I pass the environment url from the deployment from the pipeline. 


within the TestComplete.exe I am able to do it by commandline:

for example: "C:\Program Files (x86)\SmartBear\TestComplete 14\x64\Bin\TestComplete.exe" "D:\Project\project.pjs" /r "env="

This works fine with the code written above.


But now, I want it running through the pipeline.... how to put through the url??



Occasional Contributor

Ok, I have the answer from:
Thank you for reaching out to us. Currently, it's not possible to control what parameters TestComplete will be launched with when using the Azure DevOps integration. So, I suggest that you pass the parameter to the agent machine using a scripting task (
CMD or Powershell). For example, you can create a file and store the URL there or set an environment variable
that will hold the value. Then, you need to modify the test accordingly so that the URL is ready from the file or obtained from the environment variable.


With this answer from SmartBear self in mind, I created an xml file in the directory:

<?xml version="1.0"?>








The #{..}# are used to replace the url as token from Azure Pipeline.


Then i wrote this script:

function RetrieveUrlFromDeployment()
// Create a COM object
var configFileXML = Sys.OleObject("Msxml2.DOMDocument.6.0");
configFileXML.async = false;

// Load data from a XML file

// Set error message when failure
if(configFileXML.parseError.errorCode != 0)
var errorMessage = "Reason:\t" + configFileXML.parseError.reason + "\n" +
"Line:\t" + aqConvert.VarToStr(configFileXML.parseError.line) + "\n" +
"Pos:\t" + aqConvert.VarToStr(configFileXML.parseError.linePos) + "\n" +
"Source:\t" + configFileXML.parseError.srcText;
// Post an error to the log and exit
Log.Error("Cannot parse the document.", errorMessage);

// Use an XPath expression to obtain a list of "url" nodes
var nodes = configFileXML.selectNodes("url");

// Set Project variable to environment url.
Project.Variables.url_loginscreen = nodes.context.text;


This will result that TC will be able to get indirectly receive a url from Azure pipeline.

Showing results for 
Search instead for 
Did you mean: