Forum Discussion

nicktulett's avatar
nicktulett
Contributor
13 years ago

Executing UNIX commands through SSH in TestComplete

Download winscp



Create a session to log in to your UNIX box



Then to test the wiring, this should return the first 12 lines of top on your Unix test box.




function Davros() {

    var shell = Sys.OleObject("WScript.Shell");

    var winscp = shell.Exec("C:\\...\\winscp.com UNIXtestserver /console /command \"call top -b | head -n 12\"");//replace with location of winscp.com and name of your server session

    winscp.StdIn.Write("exit\n");

    Log.Message(winscp.StdOut.ReadAll());

}





So you should now be able to execute any UNIX command via a TestComplete script.



Remember that with great power comes great responsibility...