summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@gmail.com>2016-03-24 19:22:18 -0600
committerE.Z. Hart <hartez@gmail.com>2016-03-24 19:22:18 -0600
commit1f627587ac51bb820ad731463dcfe97675721f23 (patch)
tree0643982a1ad44c961d5fc5f3e4f7fa4e70ec7aa3
parent03c84382c7bfa6d8712e07dfa48e569f9a9b66a7 (diff)
downloadxamarin-forms-1f627587ac51bb820ad731463dcfe97675721f23.tar.gz
xamarin-forms-1f627587ac51bb820ad731463dcfe97675721f23.tar.bz2
xamarin-forms-1f627587ac51bb820ad731463dcfe97675721f23.zip
Add script to determine if previous UI test results can be reused
-rw-r--r--check-previous-test-results.sh71
1 files changed, 71 insertions, 0 deletions
diff --git a/check-previous-test-results.sh b/check-previous-test-results.sh
new file mode 100644
index 00000000..b9f3b117
--- /dev/null
+++ b/check-previous-test-results.sh
@@ -0,0 +1,71 @@
+appfolder="$1"
+rootfolder="$2"
+changesfile="$3"
+platformkeyword="$4"
+
+previousrunfolder="$rootfolder/PreviousUITestResults"
+should_run_tests=false
+
+echo "Looking for $previousrunfolder"
+
+if test -e $previousrunfolder
+then
+ echo "Found previous build's test results folder"
+else
+ should_run_tests=true
+ echo "Previous test results folder not found"
+fi
+
+echo "Looking for $previousrunfolder/nunit_output.xml"
+
+if test -e $previousrunfolder/nunit_output.xml
+then
+ echo "Found previous NUnit results"
+else
+ should_run_tests=true
+ echo "Previous NUnit results not found"
+fi
+
+if test -e $changesfile
+then
+ echo "Found list of changes:"
+ changes_require_tests=false
+ cat $changesfile
+
+ # Look for platform-specific code changes
+ if grep -q $platformkeyword $changesfile
+ then
+ echo "Found changes to $platformkeyword stuff"
+ should_run_tests=true
+ changes_require_tests=true
+ fi
+
+ # Now check for universal stuff (Core, Issues...)
+ if grep -q -e 'Xamarin\.Forms\.Controls' -e 'Xamarin\.Forms\.Core' -e 'Xamarin\.Forms\.CustomAttributes' -e 'Xamarin\.Forms\.Xaml' $changesfile
+ then
+ echo "Found changes which require a UI Tests run"
+ should_run_tests=true
+ changes_require_tests=true
+ fi
+
+ if ! $changes_require_tests
+ then
+ echo "No changes which require a UI Tests run for $platformkeyword were found"
+ fi
+
+else
+ should_run_tests=false
+ echo "No changes in this build"
+fi
+
+if $should_run_tests
+then
+ echo "Can't reuse previous results; UI tests will be run."
+ touch $appfolder/noresults.xml
+ exit 1
+else
+ echo "We can just reuse the previous test results"
+ echo "##teamcity[importData type='nunit' path='$previousrunfolder/nunit_output.xml' parseOutOfDate='true']"
+ cp $previousrunfolder/nunit_output.xml $appfolder/nunit_output.xml
+ exit 0
+fi \ No newline at end of file