Contributions
Re: Running Windows PowerShell during test execution
it is supposed to run the powershell script that it's path specified by the variable "powerShellScript" And the outline for this function is copied from the documentation https://support.smartbear.com/testcomplete/docs/testing-with/advanced/using-external-functions/running-powershell-scripts.html421Views0likes0CommentsRunning 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();448Views0likes5Comments