caipivara
1/9/2015 - 8:44 PM

Run xcpretty over xcodebuild with reports script

Run xcpretty over xcodebuild with reports script

#!/bin/bash
#
# Script to run tests and see a beautiful output using xcpretty.
#

# Validations
if ! which xcpretty >/dev/null; then
  echo "Please install xcpretty to run this script."
  exit 1
fi

# Project description
WORKSPACE=<workspace>.xcworkspace
SCHEME=<scheme>
SDK=iphonesimulator

# Run Test
xcodebuild -workspace $WORKSPACE -scheme $SCHEME -destination 'platform=iOS Simulator,name=iPhone 5,OS=8.1' clean test | xcpretty -c   --report html

# Open Results
REPORT_PATH='/build/reports/tests.html'
LOCAL_PATH=$(pwd)

URL='file://'$LOCAL_PATH$REPORT_PATH
URL=${URL// /%20}

open $URL