Skip to content

Commit 903624b

Browse files
yasirfolio3Michael Ng
authored andcommitted
feat(gherkin): Integration of gherkin tests as stage in travis. (#152)
1 parent 0f77426 commit 903624b

File tree

2 files changed

+81
-1
lines changed

2 files changed

+81
-1
lines changed

.travis.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ install:
66
- eval "$(gimme)"
77
stages:
88
- 'Lint'
9-
# - 'Integration tests'
109
- 'Unit test'
10+
- 'Integration tests'
1111
jobs:
1212
include:
1313
- stage: 'Lint'
@@ -54,3 +54,13 @@ jobs:
5454
- go get github.com/mattn/goveralls
5555
after_success:
5656
- $GOPATH/bin/goveralls -coverprofile=profile.cov -service=travis-ci
57+
- stage: 'Integration tests'
58+
env: GIMME_GO_VERSION=1.12.x FSC_PATH="/tmp/fsc-repo"
59+
before_script:
60+
- mkdir -p $FSC_PATH
61+
- pushd $FSC_PATH && git init && git fetch --depth=1 https://[email protected]/optimizely/fullstack-sdk-compatibility-suite ${FSC_BRANCH:-master} && git checkout FETCH_HEAD && popd
62+
install:
63+
- eval "$(gimme)"
64+
script:
65+
- ./scripts/run-fsc-tests.sh -f "$FSC_PATH/features/" -d "$FSC_PATH/features/support/datafiles/" -t "$TAGS"
66+

scripts/run-fsc-tests.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/bash
2+
3+
# This script fetches Full stack compatibility suite and copies all the feature files and datafiles to the given paths.
4+
5+
# inputs:
6+
# FEATURES_PATH - destination path to copy feature files (required)
7+
# DATAFILES_PATH - destination path to use for datafiles (required)
8+
# TAG_FILTER_EXPRESSION - Gherkin filter
9+
FEATURE_FILES_PATH="${FEATURES_PATH:-}"
10+
DATAFILES_PATH="${DATAFILES_PATH:-}"
11+
TAG_FILTER_EXPRESSION=""
12+
usage() { echo "Usage: $0 -h [-t <string>] [-f <string>] [-d <string>]" 1>&2; }
13+
14+
show_example() { cat <<EOF
15+
Example: $0 -f /usr/tests/integration/features -d /usr/support/fsc-datafiles -t "@FEATURE_ROLLOUT && ~@INPUT_FILTER"
16+
EOF
17+
}
18+
19+
while getopts ":t:f:d:h" o; do
20+
case "${o}" in
21+
f)
22+
FEATURE_FILES_PATH=${OPTARG}
23+
;;
24+
d)
25+
DATAFILES_PATH=${OPTARG}
26+
;;
27+
t)
28+
TAG_FILTER_EXPRESSION=${OPTARG}
29+
;;
30+
h)
31+
usage
32+
echo
33+
show_example
34+
exit 1
35+
;;
36+
*)
37+
usage
38+
exit 1
39+
;;
40+
esac
41+
42+
done
43+
shift $((OPTIND-1))
44+
45+
46+
if [ -z "$FEATURE_FILES_PATH" ]; then
47+
echo
48+
echo "-f is a required argument"
49+
echo
50+
show_example
51+
exit 1
52+
fi
53+
54+
if [ -z "$DATAFILES_PATH" ]; then
55+
echo
56+
echo "-d is a required argument"
57+
echo
58+
show_example
59+
exit 1
60+
fi
61+
62+
set -ex
63+
GO_FEATUREFILES_PATH="$(pwd)/tests/integration/features"
64+
rm -rf $GO_FEATUREFILES_PATH
65+
mkdir -p $GO_FEATUREFILES_PATH
66+
cp -r $FEATURE_FILES_PATH $GO_FEATUREFILES_PATH
67+
68+
export DATAFILES_DIR="$DATAFILES_PATH"
69+
go test -v $(pwd)/tests/integration --godog.tags="$TAG_FILTER_EXPRESSION"
70+
echo "Ready for testing."

0 commit comments

Comments
 (0)