HTML and CSS Reference
In-Depth Information
examples. The jar file can be placed anywhere on the system, I suggest
~/bin
.To
make it easier to run, set up an environment variable to point to this directory, as
shown in Listing 3.3.
Listing 3.3
Setting the $JSTESTDRIVER HOME environment variable
export JSTESTDRIVER_HOME=~/bin
Set the environment variable in a login script, such as
.bashrc
or
.zshrc
(depends on the shell—most systems use Bash, i.e.,
~/.bashrc
, by default).
3.4.3.2 Windows Users
Windows users can set an environment variable in the
cmd
command line by issuing
the
set JSTESTDRIVER
_
HOME=C:
\
bin
command. To set it permanently, right-
click
My Computer
(
Computer
in Windows 7) and select
Properties.
In the
System
window
, select
Advanced system properties,
then the
Advanced tab,
and then click
the
Environment Variables
...
button. Decide if you need to set the environment
variable for yourself only or for all users. Click
New
, enter the name (JSTEST-
DRIVER HOME) in the top box, and then the path where you saved the jar file in
the bottom one.
3.4.3.3 Start the Server
To run tests through JsTestDriver, we need a running server to capture browsers
with. The server can run anywhere reachable from your machine—locally, on a
machine on the local network, or a public facing machine. Beware that running
the server on a public machine will make it available to anyone unless the machine
restricts access by IP address or similar. To get started, I recommend running the
service locally; this way you can test while being offline as well. Open a shell and issue
the command in either Listing 3.4 or Listing 3.5 (current directory is not important
for this command).
Listing 3.4
Starting the JsTestDriver server on Linux and OSX
java -jar $JSTESTDRIVER_HOME/JsTestDriver-1.2.1.jar --port
4224
Listing 3.5
Starting the JsTestDriver server on Windows
java -jar %JSTESTDRIVER_HOME%\JsTestDriver-1.2.1.jar --port
4224