-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-integration-tests.sh
executable file
·65 lines (57 loc) · 1.26 KB
/
run-integration-tests.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
57
58
59
60
61
62
63
64
65
#!/bin/bash
usage() {
cat << EOF
Runs the integration tests.
Options:
-f <filter> --filter <filter> Filter the tests by name (optional)
-e <path> --env-file <path> Path to an environment file (optional) eg. .env.accounts.integration
-h --help Prints this help message and exits
EOF
}
# defaults
# parameters
while [ -n "$1" ]; do
case $1 in
-e | --env-file)
shift
ENV_PATH=$1
;;
-f | --filter)
shift
FILTER=$1
;;
-h | --help)
usage
exit 0
;;
*)
echo "Unknown option $1..."
usage
exit 1
;;
esac
shift
done
# if ENV_PATH is provided - source environment variables from it
if [ ! -z "$ENV_PATH" ]; then
if [ ! -f "$ENV_PATH" ]; then
echo "Environment file not found: $ENV_PATH"
usage
exit 1
else
echo "Environment config path: $ENV_PATH"
echo
set -o allexport
source $ENV_PATH
set +o allexport
fi
fi
if [ ! -z "$FILTER" ]; then
echo "Running unit tests with filter: $FILTER"
echo
dotnet test --verbosity normal --filter "TestCategory=Integration&FullyQualifiedName~$FILTER"
else
echo "Running all unit tests..."
echo
dotnet test --verbosity normal --filter TestCategory=Integration
fi