Running Windows PowerShell during test execution
I am trying to run a powershell script during executing a test cases, but I am not quite sure what is wrong with the function I'm using.
function sendHttpPostRequest() {
var path_org = Project.Path;
var path = aqString.Replace(path_org, "\\","/");
var powerShellScript = path + "PS_request/POST_REQ.PS1";
var oShell = getActiveXObject("WScript.Shell");
var oExec = oShell.Exec(`powershell -file ${powerShellScript}`);
oExec.StdIn.Close(); // Close standard input before reading output
// Get PowerShell output
var strOutput = oExec.StdOut.ReadAll();
// Trim leading and trailing empty lines
strOutput = aqString.Trim(strOutput, aqString.stAll);
// Post PowerShell output to the test log line by line
aqString.ListSeparator = "\r\n";
for (var i = 0; i < aqString.GetListLength(strOutput); i++)
{
Log.Message(aqString.GetListItem(strOutput, i));
}
}
sendHttpPostRequest();