From 66208a62680b35d908794e58da20aa2705bb773c Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 27 Oct 2015 10:15:16 -0400 Subject: [PATCH] Add packaging for UI tests --- FakeDemo/build.fsx | 26 +++++++++++++++++++++++--- FakeDemo/packageHelpers.fsx | 17 +++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 FakeDemo/packageHelpers.fsx diff --git a/FakeDemo/build.fsx b/FakeDemo/build.fsx index 17f9871..cdd9a66 100644 --- a/FakeDemo/build.fsx +++ b/FakeDemo/build.fsx @@ -1,4 +1,5 @@ #r "packages/FAKE/tools/FakeLib.dll" +#load "packageHelpers.fsx" open Fake open Fake.XamarinHelper @@ -34,12 +35,29 @@ Target "Run-UnitTests" (fun _ -> }) ) -Target "Run-UITests" (fun _ -> +Target "Run-AndroidUITests" (fun _ -> + let source = PackageHelpers.androidPackage() + + let dest = + filename source.FullName + |> sprintf "./RebuyApp.Android.UITests/%s" + |> fileInfo + |> PackageHelpers.moveAndroidApk source + + !! @"./**/RebuyApp.Android.UITests/bin/Release/RebuyApp.Android.UITests.dll" + |> NUnit (fun defaults -> { defaults with ErrorLevel = DontFailBuild }) + + Shell.Exec("adb", "uninstall de.rebuy.android") + |> ignore + + DeleteFile dest.FullName +) + +Target "Run-iOSUITests" (fun _ -> uiTestDll |> NUnit ( fun defaults -> { defaults with ToolPath = "/Library/Frameworks/Mono.framework/Commands/" ToolName = "nunit-console4" - DisableShadowCopy = true }) ) @@ -56,7 +74,7 @@ Target "Build-iOS" (fun _ -> { defaults with ProjectPath = "iOS/FakeDemo.iOS.csproj" OutputPath = "iOS/iPhoneSimulator/Debug" - Configuration = "Debug|iPhoneSimulator" + Configuration = "Ad-Hoc|iPhone" Target = "Build" }) ) @@ -75,5 +93,7 @@ Target "Build-Droid" (fun _ -> ==> "Build-Pcl" ==> "Build-iOS" ==> "Build-Droid" + ==> "Build-UITests" + ==> "Run-AndroidUITests" RunTargetOrDefault "Run-UnitTests" \ No newline at end of file diff --git a/FakeDemo/packageHelpers.fsx b/FakeDemo/packageHelpers.fsx new file mode 100644 index 0000000..0366ba1 --- /dev/null +++ b/FakeDemo/packageHelpers.fsx @@ -0,0 +1,17 @@ +#r "packages/FAKE/tools/FakeLib.dll" +open System.IO +open Fake +open Fake.XamarinHelper + +let androidPackage() = + AndroidPackage (fun defaults -> + { + defaults with + ProjectPath = "Droid/FakeDemo.Droid.csproj" + }) + +let moveAndroidApk (source : FileInfo) (dest : FileInfo) = + DeleteFile dest.FullName + Rename dest.FullName source.FullName + + dest