1 |
#!/bin/sh |
#!/bin/sh |
2 |
|
# selenium.sh - run Selenium tests |
3 |
|
# Copyright (C) 2008 siliconforks.com |
4 |
|
# |
5 |
|
# This program is free software; you can redistribute it and/or modify |
6 |
|
# it under the terms of the GNU General Public License as published by |
7 |
|
# the Free Software Foundation; either version 2 of the License, or |
8 |
|
# (at your option) any later version. |
9 |
|
# |
10 |
|
# This program is distributed in the hope that it will be useful, |
11 |
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
|
# GNU General Public License for more details. |
14 |
|
# |
15 |
|
# You should have received a copy of the GNU General Public License along |
16 |
|
# with this program; if not, write to the Free Software Foundation, Inc., |
17 |
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
18 |
|
|
19 |
set -e |
set -e |
20 |
|
|
25 |
kill $selenium_server_pid |
kill $selenium_server_pid |
26 |
} |
} |
27 |
|
|
28 |
|
server_is_running() { |
29 |
|
netstat -a -n | grep -q '\(::\|0\.0\.0\.0\):4444' |
30 |
|
} |
31 |
|
|
32 |
java -cp build Server ../doc/instrumented > server.out 2> server.err & |
java -cp build Server ../doc/instrumented > server.out 2> server.err & |
33 |
server_pid=$! |
server_pid=$! |
34 |
|
|
36 |
selenium_server_pid=$! |
selenium_server_pid=$! |
37 |
|
|
38 |
# wait for the HTTP server to start |
# wait for the HTTP server to start |
39 |
while ! netstat -a -n --inet --inet6 | grep -q :::8000 |
while ! server_is_running |
40 |
do |
do |
41 |
sleep 0.1 |
sleep 0.1 |
42 |
done |
done |
43 |
|
|
44 |
# wait for the selenium server to start |
# wait for the selenium server to start |
45 |
while ! netstat -a -n --inet --inet6 | grep -q :::4444 |
while ! server_is_running |
46 |
do |
do |
47 |
sleep 0.1 |
sleep 0.1 |
48 |
done |
done |
49 |
|
|
50 |
java -cp junit.jar:selenium-java-client-driver.jar:build junit.textui.TestRunner JSCoverageTest |
uname=`uname` |
51 |
|
case "$uname" in |
52 |
|
CYGWIN* | MINGW*) |
53 |
|
separator=';' |
54 |
|
;; |
55 |
|
*) |
56 |
|
separator=':' |
57 |
|
;; |
58 |
|
esac |
59 |
|
|
60 |
|
java -cp "junit.jar${separator}selenium-java-client-driver.jar${separator}build" junit.textui.TestRunner JSCoverageTest |