1 |
siliconforks |
234 |
#!/bin/sh |
2 |
siliconforks |
263 |
# selenium.sh - run Selenium tests |
3 |
siliconforks |
505 |
# Copyright (C) 2008, 2009, 2010 siliconforks.com |
4 |
siliconforks |
263 |
# |
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 |
siliconforks |
234 |
|
19 |
|
|
set -e |
20 |
|
|
|
21 |
|
|
trap cleanup 0 1 2 3 15 |
22 |
|
|
|
23 |
|
|
cleanup() { |
24 |
|
|
kill $server_pid |
25 |
|
|
kill $selenium_server_pid |
26 |
|
|
} |
27 |
|
|
|
28 |
siliconforks |
262 |
server_is_running() { |
29 |
|
|
netstat -a -n | grep -q '\(::\|0\.0\.0\.0\):4444' |
30 |
|
|
} |
31 |
|
|
|
32 |
siliconforks |
234 |
java -cp build Server ../doc/instrumented > server.out 2> server.err & |
33 |
|
|
server_pid=$! |
34 |
|
|
|
35 |
|
|
java -jar selenium-server.jar -multiWindow > selenium.out 2> selenium.err & |
36 |
|
|
selenium_server_pid=$! |
37 |
|
|
|
38 |
|
|
# wait for the HTTP server to start |
39 |
siliconforks |
262 |
while ! server_is_running |
40 |
siliconforks |
234 |
do |
41 |
|
|
sleep 0.1 |
42 |
|
|
done |
43 |
|
|
|
44 |
|
|
# wait for the selenium server to start |
45 |
siliconforks |
262 |
while ! server_is_running |
46 |
siliconforks |
234 |
do |
47 |
|
|
sleep 0.1 |
48 |
|
|
done |
49 |
|
|
|
50 |
siliconforks |
262 |
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 |