-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner.sh
45 lines (40 loc) · 1.34 KB
/
runner.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#-------------------------------------------------------------------
# This script expects the following environment variables
# HUB_HOST_IP
# BROWSER
# THREAD_COUNT
# TEST_SUITE
#-------------------------------------------------------------------
# Let's print what we have received
echo "-------------------------------------------"
echo "HUB_HOST_IP : ${HUB_HOST_IP:-hub}"
echo "BROWSER : ${BROWSER:-chrome}"
echo "THREAD_COUNT : ${THREAD_COUNT:-1}"
echo "TEST_SUITE : ${TEST_SUITE}"
echo "-------------------------------------------"
# Do not start the tests immediately. Hub has to be ready with browser nodes
echo "Checking if hub is ready..!"
count=0
while [ "$( curl -s http://${HUB_HOST_IP:-hub}:4444/status | jq -r .value.ready )" != "true" ]
do
count=$((count+1))
echo "Attempt: ${count}"
if [ "$count" -ge 30 ]
then
echo "**** HUB IS NOT READY WITHIN 30 SECONDS ****"
exit 1
fi
sleep 1
done
# At this point, selenium grid should be up!
echo "Selenium Grid is up and running. Running the test...."
# Start the java command
java -cp 'libs/*' \
-Dselenium.grid.enabled=true \
-Dselenium.grid.hubHost="${HUB_HOST_IP:-hub}" \
-Dbrowser="${BROWSER:-chrome}" \
org.testng.TestNG \
-parallel tests \
-threadcount "${THREAD_COUNT:-1}" \
test-suites/"${TEST_SUITE}"