Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve bin/test with more functionality
`bin/test` now supports flags to customize the behavior. We can use this immediately for Circle by outputting JUnit xml that Circle can use to get some insight into our test suite.
- Loading branch information
Showing
2 changed files
with
44 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,65 @@ | ||
#!/usr/bin/env sh | ||
#!/bin/bash | ||
# | ||
# Runs tests via xcodebuild, formatting results with xcpretty. | ||
# | ||
# Usage: bin/test [options] | ||
# | ||
# Options: | ||
# -k Clean before running the tests. | ||
# -r Emit JUnit XML report. | ||
# -t Use RSpec-style test output. | ||
|
||
set -o pipefail | ||
set -eo pipefail | ||
|
||
build_actions=(test) | ||
test_reports_dir="${CIRCLE_TEST_REPORTS:-build}" | ||
xcpretty_options=(--color) | ||
|
||
while getopts krt opt; do | ||
case ${opt} in | ||
k) | ||
build_actions=(clean test) | ||
;; | ||
r) | ||
xcpretty_options+=(--report junit --output "${test_reports_dir}/test-report.xml") | ||
;; | ||
t) | ||
xcpretty_options+=(--test) | ||
;; | ||
*) | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
shift $((OPTIND - 1)) | ||
|
||
mkdir -p "${test_reports_dir}" | ||
|
||
xcrun xcodebuild \ | ||
-workspace Argo.xcworkspace \ | ||
-scheme Argo-Mac \ | ||
test \ | ||
| xcpretty --color | ||
"${build_actions[@]}" \ | ||
| xcpretty "${xcpretty_options[@]}" | ||
|
||
xcrun xcodebuild \ | ||
-workspace Argo.xcworkspace \ | ||
-scheme Argo-iOS \ | ||
-destination "platform=iOS Simulator,name=iPhone 6" \ | ||
test \ | ||
| xcpretty --color | ||
"${build_actions[@]}" \ | ||
| xcpretty "${xcpretty_options[@]}" | ||
|
||
xcrun xcodebuild \ | ||
-workspace Argo.xcworkspace \ | ||
-scheme Argo-watchOS \ | ||
-destination "generic/platform=watchOS" \ | ||
CODE_SIGNING_REQUIRED=NO \ | ||
CODE_SIGN_IDENTITY="" \ | ||
| xcpretty --color | ||
| xcpretty "${xcpretty_options[@]}" | ||
|
||
xcrun xcodebuild \ | ||
-workspace Argo.xcworkspace \ | ||
-scheme Argo-tvOS \ | ||
-destination "platform=tvOS Simulator,name=Apple TV 1080p" \ | ||
test \ | ||
| xcpretty --color | ||
"${build_actions[@]}" \ | ||
| xcpretty "${xcpretty_options[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ dependencies: | |
|
||
test: | ||
override: | ||
- bin/test | ||
- bin/test -r |