-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexecuteTests
executable file
·105 lines (96 loc) · 2.86 KB
/
executeTests
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
#!/bin/bash
#
# ownCloud Android scenario tests
#
# @author Jesus Recio (@jesmrec)
# Copyright (C) 2021 ownCloud GmbH.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2,
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
help()
{
echo ""
echo "Usage: $0 -t <filter>"
echo ""
echo -e "\t-t <filter> Used to execute tagged tests. F. ex: @createfolder will send only tests tagged with such label. OR/AND operations are allowed. It is also allowed to use a classpath to execute all the test in such class"
echo -e ""
echo -e "Examples:"
echo -e ""
echo -e "\t\t ./executeTests -t @createfolder -> This will execute only tests with the tag @createfolder"
echo -e ""
echo -e "\t\t ./executeTests -t '@createfolder and @copy' -> This will execute tests tagged with both @createfolder and @copy"
echo -e ""
echo -e "\t\t ./executeTests -t '@createfolder or @copy' -> This will execute tests tagged with @createfolder or @copy"
echo -e ""
echo -e "\t\t ./executeTests -> This will execute all the tests"
echo -e ""
echo -e "Some environment variables are needed to work as well:"
echo -e ""
echo -e "\t\t\$OC_SERVER_URL (mandatory): URL of ownCloud server to test against"
echo -e ""
echo -e "\t\t\$UDID_DEVICE (optional): UDID of the device to execute the tests against. Get from adb devices command"
echo -e ""
echo -e "\t\t\$APPIUM_URL (optional): Appium server URL. if Appium Server is not specified, will be used \"localhost:4723/wd/hub\""
echo -e ""
echo -e "The option -h: will show this help"
echo -e ""
echo -e ""
exit 1
}
checklogs()
{
if [ ! -d "logs" ]
then
mkdir ./logs
else
echo "Logs folder already exists";
fi
}
checklogs
while getopts "t::h" opt; do
case $opt in
t) tags="$OPTARG"
;;
h) help
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
export oc=$OC_SERVER_URL
export appium=$APPIUM_URL
export udid=$UDID_DEVICE
if [ -z "$oc" ]
then
echo "ownCloud Server URL is missing. Please export the variable OC_SERVER_URL with the server URL to test against";
help
fi
echo "Appium server: $appium"
echo "oC server: $oc"
echo "tags: $tags"
echo "udid: $udid"
if [ -z "$tags" ]
then
./gradlew clean test \
--info \
-Dappium=$appium \
-Dudid=$udid \
-Dserver=$oc
else
./gradlew clean test \
--info \
-Dcucumber.filter.tags="$tags" \
-Dappium=$appium \
-Ddevice=$udid \
-Dserver=$oc
fi