-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun.sh
executable file
·56 lines (47 loc) · 1.3 KB
/
run.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
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
set -e
print_usage() {
echo "Executes test cases for the given Test Suites - TS."
echo "A TS is a collection of test cases that are intended to be used to test a specific DHIS2 module or functionality."
echo
echo "Usage: "
echo " $0 [scenarios...]"
echo " $0 -h|--help"
echo
echo "Test Suites:"
echo " USER DHIS2 API - Users Module."
echo " DATA_ADMIN DHIS2 API - Data Administration."
echo " OTHER This needs some care, please implement."
}
function validate_input() {
if [ "$1" == "-h" ]; then
print_usage
exit 0
elif [[ "$#" < 1 ]]; then
echo "$0 : too few arguments. It's not supported to run all scenarios at once."
exit 1
fi
}
function execute_test() {
scenario=$(echo $1 | awk '{print toupper($0)}')
case $scenario in
USER)
mocha modules/users/user.js --timeout 10000
;;
DATA_ADMIN)
mocha modules/data-admin/optionSet.js --timeout 10000
;;
OTHER)
echo "This needs some care, please implement."
;;
*)
echo "Unknown scenario '$1'"
print_usage
exit 1
esac
}
validate_input "$@"
for scenario in "$@"
do
execute_test "$scenario"
done