Created
January 25, 2019 02:35
-
-
Save 15mgm15/ae4801b65bfda9a2bc08fef47252e636 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
# | |
# For Xamarin, run all NUnit test projects that have "Unit" in the name. | |
# The script will build, run and display the results in the build logs. | |
echo "Found NUnit test projects:" | |
find $APPCENTER_SOURCE_DIRECTORY -regex '.*Unit.*\.csproj' -exec echo {} \; | |
echo | |
echo "Building NUnit test projects:" | |
find $APPCENTER_SOURCE_DIRECTORY -regex '.*Unit.*\.csproj' -exec msbuild {} \; | |
echo | |
echo "Compiled projects to run NUnit tests:" | |
find $APPCENTER_SOURCE_DIRECTORY -regex '.*bin.*Unit.*\.dll' -exec echo {} \; | |
echo | |
echo "Running NUnit tests:" | |
find $APPCENTER_SOURCE_DIRECTORY -regex '.*bin.*Unit.*\.dll' -exec nunit3-console {} + | |
echo | |
echo "NUnit tests result:" | |
pathOfTestResults=$(find $APPCENTER_SOURCE_DIRECTORY -name 'TestResult.xml') | |
cat $pathOfTestResults | |
echo | |
#look for a failing test | |
grep -q 'result="Failed"' $pathOfTestResults | |
if [[ $? -eq 0 ]] | |
then | |
echo "------------ A test Failed!!! --------------" | |
exit 1 | |
else | |
echo "------------ All tests passed :D --------------" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment