-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestPlanRunner.sh
More file actions
executable file
·109 lines (90 loc) · 2.28 KB
/
TestPlanRunner.sh
File metadata and controls
executable file
·109 lines (90 loc) · 2.28 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
PBE=172.20.37.172
STEP=1
scriptName="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")"
exitCode=0
start_time=`date +%s`
function usage {
echo "Default backend PBE server : $PBE"
echo "Usage: $scriptName [Test Plan File] [print]optional"
exit 1
}
function pause {
read -n1 -r -p "Press any key to continue ..." </dev/tty
if [ $? -eq 0 ]; then
echo
else
echo
fi
}
if [[ "$1" != "" ]]
then if [ ! -f $1 ]
then
echo "Test file $1 does not exist - aborting!!"
exit 1
fi
else
usage
exit 1
fi
if [[ "$2" == "print" ]]
then
verbose=TRUE
fi
if [[ "$2" == "pause" || "$3" == "pause" ]]
then
isPause=TRUE
fi
testFile=$1
input=$testFile
while IFS=, read TEST_DESCRIPTION TEST_PARAMS PASS_FACTOR TEST_TYPE
do
./TestSelector.sh $TEST_PARAMS >.testResults.$testFile.step$STEP
if [[ "$PASS_FACTOR" == "PASS_ALWAYS" ]]
then testResult=PASSED
else
testResult=`grep $PASS_FACTOR .testResults.$testFile.step$STEP > /dev/null && echo "PASSED" || echo FAILED`
fi
if [[ $verbose == "TRUE" ]]; then
echo "================ [Sending XML] ====================================================="
cat .temp.xml
echo "===================================================================================="
fi
if [[ $verbose == "TRUE" ]]; then echo "******************************************************************************************************";fi
echo "Step $STEP : $TEST_DESCRIPTION [$testResult]"
if [[ $verbose == "TRUE" ]]; then echo "******************************************************************************************************";fi
if [[ $verbose == "TRUE" ]]
then
cat .testResults.$testFile.step$STEP
fi
if [[ "$TEST_TYPE" == "CRITICAL" && "$testResult" == "FAILED" ]]
then
echo "Critical step failed, abort test !!"
echo
echo "=== File $testFile : TEST FAILED ==="
exit 1
fi
if [[ "$testResult" == "FAILED" ]]
then
exitCode=1;
fi
STEP=$((STEP+1))
if [[ "$isPause" == "TRUE" ]]
then
pause
fi
done < "$input"
if [[ "$exitCode" == 0 ]]
then
echo
echo "=== File $testFile : TEST PASSED SUCCESSFULLY ==="
echo
else
echo
echo "=== File $testFile : TEST FAILED ==="
echo
fi
end_time=`date +%s`
time_elapsed=$(($end_time-$start_time))
echo "Execution time : $time_elapsed seconds."
exit $exitCode