Hi
I've written a very basic login module in node.js, which works fine, but I need the following base modules enclosed:
var exec = require('child_process').exec; var stream = require('stream');
is this possible, there is nothing about importing modules in
https://support.smartbear.com/testcomplete/docs/scripting/specifics/javascript.html
testComplete give me this:
Error: Unable to find the specified module
Thanks
Solved! Go to Solution.
I repeat:
TestComplete does not use nodejs. To do what you want to do, you need to
1) Include the explicit code units into the TestComplete project
or
2) Create some sort of class library (.NET, Java, etc) that you can bring in using JavaBridge or CLR bridge to call that code.
TestComplete is not the same type of environment as a regular IDE. If you want to include external JavaScript code into TestComplete, you need to bring the units into TestComplete itself. It doesn't consume nodejs like a web browser would normally.
So "child_process" and "stream" are JS modules that you would need to add to the TestComplete project via the Add -> Existing Item dialogs.
Thanks for the reply,
I think this is impossible because they are native on node.js and links in lots of other requirements
https://github.com/nodejs/node/blob/master/lib/child_process.js
https://github.com/nodejs/node/blob/master/lib/stream.js
I can run it via wsShell, but would like to use nodejs toget finegrained interrupts and pipes etc
function RunTest(commandStr) {
var wsShell = Sys.OleObject("WScript.Shell");
wsShell.CurrentDirectory = Project.Variables.TestWorkingDirectory;
try {
wsShell.Exec(commandStr);
}
catch (ex) {
Log.Error("Command '" + commandStr + "' failed with:" + ex.description);
}
}
I repeat:
TestComplete does not use nodejs. To do what you want to do, you need to
1) Include the explicit code units into the TestComplete project
or
2) Create some sort of class library (.NET, Java, etc) that you can bring in using JavaBridge or CLR bridge to call that code.
Thank you tristaanogre!
@mortenb123 did you get a chance to try the suggested approaches? Please share the results