When possible, the various hosts have the follow command line argument flags that are supported by the main()
function in commonHost.js:
-e|--e|-echo|--echo
- Echo the command that would be run by hand to replicate the test. This is helpful for use under Ant apply.
-h|--h|-help|--help
- Print a usage message
-j|--j|-js|--js filename.js
- Execute the JavaScript file specified in a context providing an
instantiate
function to instantiate accessors.
-t|--t|-timeout|--timeout milliseconds
- The minimum amount of time the script should run.
-v|--v|-version|--version
- Print out version information.
Interleaved anywhere with the flags can be the full class name for any accessor (such as net/REST
). Such an accessor will be instantiated and initialized. This is particularly useful for that have useful functionality, such as taking action at certain times or listening for incoming network messages.
The particular command that accepts these options depends on which host you are invoking. Assuming that the host provides a command script called hostScript
to invoke it, then here are some sample usages:
hostScript
: Return a description of the arguments. (Optional. The binary can also enter an interactive mode with a prompt and read commands from stdin)
hostScript -h
: Print a help message.
hostScript -js foo.js
: Invoke foo.js
as a regular JavaScript file.
hostScript -timeout 2000 -js foo.js
: Invoke foo.js
as a regular JavaScript file and exit after 2000 milliseconds.
hostScript path/AccessorClass
: Instantiate AccessorClass
and initialize it.
hostScript -timeout 2000 path/AccessorClass
: Instantiate AccessorClass
, initialize it, and invoke wrapup after 2000 milliseconds.
hostScript -timeout 2000 -js foo.js path/AccessorClass
: Evaluate foo.js
, then instantiate and initialize AccessorClass
, and then exit after 2000 milliseconds.
Status
Browser Host
- Not Applicable because the Browser Host does not run from the command line.
Cape Code Host
- The Cape Code Host is not intended to be invoked from the command line. Use the Nashorn Host instead.
Cordova Host
Duktape Host
Nashorn Host
Node Host
- Supports all of the above, where
accessors/web/hosts/node/nodeHostInvoke.js
is a script to be invoked by node
Rusteduk
SeeAlso