Ask a Question

Get "filePath" value set for -exportLogs parameter on tests start

SOLVED
kakabubu
Contributor

Get "filePath" value set for -exportLogs parameter on tests start

We're running the tests with PowerShell command 

$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$folderName = $env:logsPath
$pinfo.FileName = "C:\Program Files (x86)\SmartBear\TestComplete 14\Bin\TestComplete.exe"
$pinfo.Arguments = "$projectSuitePath /r $(if ($project) {"/project:$project "} else {''})/e /SilentMode /el:$folderName\index.htm /es:$folderName\summary.htm"
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null
$p.WaitForExit()

Before running the tests, unique filePath is generated by another script.
The Path is used in the testСomplete project to post logs on start and on error.

Now I'm using the environment variable to solve this issue.
Is there a way to get the value of that parameter in test complete scripts?

2 ACCEPTED SOLUTIONS

Accepted Solutions
cunderw
Community Hero

Re: Get "filePath" value set for -exportLogs parameter on tests start

Yes, you definitely can!

 

https://support.smartbear.com/testcomplete/docs/working-with/automating/command-line-and-exit-codes/...

 

The section Remarks will guide you through creating a parser for your custom command line args.


Thanks,
Carson

Click the Accept as Solution button if my answer has helped

View solution in original post

kakabubu
Contributor

Re: Get "filePath" value set for -exportLogs parameter on tests start

Thank you a lot!
As a result, I got the function below:

function getCommandLineArgs() {
let args = { file_name: BuiltIn.ParamStr(1) };
let argsList = [];
for (let i = 2; i <= BuiltIn.ParamCount(); i++) argsList.push(BuiltIn.ParamStr(i));
argsList.forEach(p => {
const [key, value] = p.substring(1).split(/:(.+)/);
args[key] = value == null ? true : value;
});
return args;
}

View solution in original post

2 REPLIES 2
cunderw
Community Hero

Re: Get "filePath" value set for -exportLogs parameter on tests start

Yes, you definitely can!

 

https://support.smartbear.com/testcomplete/docs/working-with/automating/command-line-and-exit-codes/...

 

The section Remarks will guide you through creating a parser for your custom command line args.


Thanks,
Carson

Click the Accept as Solution button if my answer has helped

View solution in original post

kakabubu
Contributor

Re: Get "filePath" value set for -exportLogs parameter on tests start

Thank you a lot!
As a result, I got the function below:

function getCommandLineArgs() {
let args = { file_name: BuiltIn.ParamStr(1) };
let argsList = [];
for (let i = 2; i <= BuiltIn.ParamCount(); i++) argsList.push(BuiltIn.ParamStr(i));
argsList.forEach(p => {
const [key, value] = p.substring(1).split(/:(.+)/);
args[key] = value == null ? true : value;
});
return args;
}

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: