Ask a Question

powershell equivalent of running testexecute with command line arguments

SOLVED
dhundley
Regular Contributor

powershell equivalent of running testexecute with command line arguments

in the SmartBear support documentation is this site

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

 

that shows how to run testcomplete/testexecute using the command line. at the very bottom on the page is this:

 

If you want the command line to wait until the test (project and so on) execution is over, you can use the START command as shown in the example below:

start "My Title" /wait TestComplete.exe "C:\Work\My Projects\MySuite.pjs" /run /exit /SilentMode

 

 

Pay attention to the string after the START command in the example above. It is the title of the command-line window and it is needed for the command to work correctly.

 

My question is, if I'm using powershell instead of a CMD window, would this line of powershell:

 

Start-Process -FilePath "C:\Program Files (x86)\SmartBear\TestExecute 15\x64\Bin\TestExecute.exe" -ArgumentList "C:\Work\My Projects\MySuite.pjs" -Wait

 

be the equivalent of the CMD example shown above from the smartbear support site? if not, then what would the powershell equivalent of it be? i'm curious about not including the /run, the /exit and the /SilentMode arguments and not giving it a title. 

 

since powershell appears to be the more accepted utility these days, shouldn't smartbear update their support site to give powershell examples instead of (or at least in addition to) command line arguments? just curious. 

18 REPLIES 18
Marsha_R
Champion Level 2

1) What happened when you tried the powershell command that you proposed?

 

2) You can put in a request for added documentation here

https://community.smartbear.com/t5/TestComplete-Feature-Requests/idb-p/TestXCompleteFeatureRequests

Kitt
Regular Contributor

Try this post [here]. With PowerShell you need to use the -Verb RunAs argument to elevate before launching TestComplete and -Wait to keep it open during runtime. 

[[ kITt: keep IT testing ]]
dhundley
Regular Contributor

Haven't actually tried it yet. wanted to get some feedback/opinions first. i will try it out in the next day or two and let you know. 

dhundley
Regular Contributor

thanks! i'll take a look at that and give it a try

rraghvani
Champion Level 2

This is the PowerShell command that I use,

 

Start-Process 'C:\Program Files (x86)\SmartBear\TestExecute 15\x64\Bin\TestExecute.exe' -ArgumentList """C:\Sandbox\TestComplete\Proj\Proj.pjs"" /run /exit /DoNotShowLog /ExportLog:""C:\Sandbox\Log\index.html"" -Wait

 

Make sure you use the correct single and double quotes.

dhundley
Regular Contributor

there did appear to be a double quote missing from the end of your example but once i corrected that, i could manually run the powershell script and it worked exactly as i wanted it to. the problem i'm having now is that i want to created a scheduled task on that VM that runs this powershell script and the scheduled task is not even getting so far as to start running testexecute. does anyone here have some experience with getting powershell scripts to run using Task Scheduler?

Kitt
Regular Contributor

@dhundley did you try -Verb RunAs as I posted earlier? Are there any errors when running the scheduler?

[[ kITt: keep IT testing ]]
dhundley
Regular Contributor

i have tried adding -Verb RunAs to the arguments in Task Scheduler and then also adding -Verb RunAs onto the start-process line inside the ps1 script that attempts to run TestExecute. neither way appears to work for me. i can run the powershell ps1 script manually from the ISE and it works just fine. i've also tried to changing the user that runs the scheduled task from the logged on user (which is what works manually) to SYSTEM. that doesn't work either. i found an online article (https://techgenix.com/how-to-schedule-powershell-scripts/) that suggests you can use powershell cmdlets to schedule it to run but i'm not very familiar with those so i'm still hoping to get Task Scheduler to work if possible

Kitt
Regular Contributor

You could try a batch file instead of PowerShell. And also, to run the task with the option "Run whether user is logged on or not" you have to activate the option "Run with highest privileges". - so check that you have that set up correctly before attempting the batch approach. And if you still have issues, try [this post] .

 

If there are any UAC restrictions, you can also attempt to bypass them using "-ExecutionPolicy ByPass".

[[ kITt: keep IT testing ]]
cancel
Showing results for 
Search instead for 
Did you mean: