Forum Discussion

MelodyHo's avatar
MelodyHo
Occasional Contributor
8 years ago

Run TestExecute from a PowerShell script

Hi,

I'm on a Windows 10 machine with TestExecute 12.

I want to run a series of tests by calling TestExecute from PowerShell and I wait until it is finished to continue in my script.

I need TE to run as an administrator to execute tests under Edge.

 

I tried :

1) Start -wait -verb runas $sTestExecutePath $sParameters

Start : to execute TE

-wait : to wait for TE to be closed

-verb runas : to start TE as an administrator 

$sTestExecutePath =  "C:\Program Files (x86)\SmartBear\TestExecute 12\Bin\TestExecute.exe"

$sParameters : list of parameters for TE = $sSlaveSolutionPath + ' /project:"' + $sProjectName + '" /LaunchConfigFile:"' + $sFileXml + '" /ExportLog:"'+ $sExitPathLog + '" /SilentMode:true /DoNotShowLog:true /run /exit' 

 

2) & cmd /c $sParameters -wait -verb runas

& cmd : I run the command prompt

$sParameters : list of parameters for TE = ' ' + $sTestExecutePath + ' ' + $sSlaveSolutionPath + ' /run /project:"' + $sProjectName + '" /LaunchConfigFile:"' + $sFileXml + '" /exit /SilentMode:true /ExportLog:"'+ $sExitPathLog + '" /DoNotShowLog:true ' 

-wait : to wait for TE to be closed

-verb runas : to start command prompt as an administrator 

 

3) & cmd /c "$sParameters" -wait

& cmd : I run the command prompt

$sTestExecutePath = TE shortcut path with the "Run as Administrator" property checked

$sParameters : list of parameters for TE =  'start /wait "TestExecute" ' + $sTestExecutePath + ' ' + $sSlaveSolutionPath + ' /project:"' + $sProjectName + '" /LaunchConfigFile:"' + $sFileXml + '" /SilentMode:true /ExportLog:"'+ $sExitPathLog + '" /DoNotShowLog:true /run /exit ' 

-wait : to wait for TE to be closed

 

NB : /LaunchConfigFile = Custom setting.

 

In all three cases, my series is launched. When it is finished, TE closes but the process remains active. So I am stuck in my PowerShell script. For my script to continue, I have to kill the TE process by hand.


Any help would be much appreciated :)


Thank's, Melody

 

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Not entirely sure.  You have the "/exit" running so that should stop the process.

     

    What privilege level are you running PowerShell as? You're having powershell run TE as an administrator but if powershell isn't an admin, that might be part of it.

    • MelodyHo's avatar
      MelodyHo
      Occasional Contributor

      Thank you for your reply ! :)

       

      PowerShell is not running in Administrator mode.

       

      I just did a launch of my test series with powershell launched as an administrator. I'm waiting for it to finish to see if it's good.