Forum Discussion
Question about the custom command line parameter script extension that you referenced: the getTCCommandLineParam. What do I need to do to get that parameter and use it in my TestComplete script? Here's an example of what I'm thinking:
Powershell script:
$testexecute = "C:\Program Files (x86)\SmartBear\TestExecute 12\Bin\TestExecute.exe"
$p = Start-Process -filepath $testexecute "`"X:\QA\Automated Testing\Vortex\Vortex.pjs`"", /environment qa, /run, /exit
TestComplete Script:
function environment()
{
//Set environment and browser variables based on parameter
ProjectSuite.Variables.Environment = getTCCommandLineParam(environment);
}
That TestComplete script will be the first thing that runs after the Powershell script runs and opens up TestExecute to run all of the tests in that Vortex project suite. Am I on the right track, or would I need to do something different to get that parameter and then use it in the TestComplete script?
You'll need to reference the object so the code should look something like:
function environment() { //Set environment and browser variables based on parameter ProjectSuite.Variables.Environment = ogreUtils.getTCCommandLineParam(environment); }
That should retrieve the value of the environment command line switch. However, the code as I've written it uses the equal sign in the parameter... so your powershell should look something like the following where the environment is set to equal qa.:
$testexecute = "C:\Program Files (x86)\SmartBear\TestExecute 12\Bin\TestExecute.exe" $p = Start-Process -filepath $testexecute "`"X:\QA\Automated Testing\Vortex\Vortex.pjs`"", /environment=qa, /run, /exit
Let me know if this works for you or if you have additional questions.
- nicklott8 years agoOccasional Contributor
Ok so I've made the changes that you suggested, and here's where I'm at:
When I run the Powershell script, it opens TestExecute, but when it runs my TestComplete script, it errors out on this line:
ProjectSuite.Variables.Environment = ogreUtils.getTCCommandLineParam(environment);
I get an error that says "You cannot run Environment Manager tests with TestExecute".
So instead of using environment, I used this instead:
ProjectSuite.Variables.Environment = ogreUtils.getTCCommandLineParam(env);
I also updated my Powershell script to say /env=qa instead of /environment=qa. When I ran it this time, I didn't get that Environment Manager error, but I did get an error that said that env was not defined. How can I define env so that I can run that TestComplete script?
- tristaanogre8 years agoEsteemed Contributor
Whoops, my bad... didn't notice you weren't calling it as a string. Change your internal code line to
ProjectSuite.Variables.Environment = ogreUtils.getTCCommandLineParam('env');
- nicklott8 years agoOccasional Contributor
That didn't seem to work either. I'm getting that "You cannot run Environment Manager tests in TestExecute" error message again.