-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for TestCloud and UITest aliases
- Loading branch information
Showing
12 changed files
with
129 additions
and
11 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
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
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
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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
using System; | ||
using Cake.Xamarin.Tests.Fakes; | ||
using NUnit.Framework; | ||
using Cake.Common.IO; | ||
using Cake.Common.Tools.NuGet; | ||
using Cake.Common.Tools; | ||
using System.Linq; | ||
using Cake.Common.Text; | ||
|
||
namespace Cake.Xamarin.Tests | ||
{ | ||
[TestFixture, Category ("TestCloudTests")] | ||
public class TestCloudTests | ||
{ | ||
FakeCakeContext context; | ||
|
||
[SetUp] | ||
public void Setup () | ||
{ | ||
context = new FakeCakeContext (); | ||
|
||
context.CakeContext.CleanDirectories ("./TestProjects/**/bin"); | ||
context.CakeContext.CleanDirectories ("./TestProjects/**/obj"); | ||
} | ||
|
||
[TearDown] | ||
public void Teardown () | ||
{ | ||
context.DumpLogs (); | ||
} | ||
|
||
[Test] | ||
public void UITestsTest () | ||
{ | ||
context.CakeContext.NuGetRestore ("./TestProjects/HelloWorldAndroid/HelloWorldAndroid.sln"); | ||
|
||
// Try and find a console runner from the installed nugets | ||
var nunitConsolePath = context.CakeContext.GetFiles ("./TestProjects/HelloWorldAndroid/**/nunit-console.exe") | ||
.FirstOrDefault (); | ||
|
||
// Build the sln so the unit tests assembly gets built | ||
context.CakeContext.DotNetBuild ("./TestProjects/HelloWorldAndroid/HelloWorldAndroid.sln"); | ||
|
||
// Build the .apk to test | ||
var apk = context.CakeContext.AndroidPackage ("./TestProjects/HelloWorldAndroid/HelloWorldAndroid/HelloWorldAndroid.csproj"); | ||
|
||
// Copy to the expected location of the UITests | ||
context.CakeContext.CopyFile (apk, "./TestProjects/HelloWorldAndroid/HelloWorldAndroid.UITests/bin/Debug/app.apk"); | ||
|
||
try { | ||
// Run the uitests | ||
context.CakeContext.UITest ("./TestProjects/HelloWorldAndroid/HelloWorldAndroid.UITests/bin/Debug/HelloWorldAndroid.UITests.dll", | ||
new Cake.Common.Tools.NUnit.NUnitSettings { | ||
ToolPath = nunitConsolePath | ||
}); | ||
} catch (Exception ex) { | ||
Console.WriteLine (ex); | ||
Console.WriteLine (context.GetLogs ()); | ||
Assert.Fail (context.GetLogs ()); | ||
} | ||
} | ||
|
||
[Test] | ||
public void TestCloudTest () | ||
{ | ||
context.CakeContext.NuGetRestore ("./TestProjects/HelloWorldAndroid/HelloWorldAndroid.sln"); | ||
|
||
// Try and find a test-cloud-exe from the installed nugets | ||
var testCloudExePath = context.CakeContext.GetFiles ("./TestProjects/HelloWorldAndroid/**/test-cloud.exe") | ||
.FirstOrDefault (); | ||
|
||
// Build the sln so the unit tests assembly gets built | ||
context.CakeContext.DotNetBuild ("./TestProjects/HelloWorldAndroid/HelloWorldAndroid.sln"); | ||
|
||
// Build the .apk to test | ||
var apk = context.CakeContext.AndroidPackage ("./TestProjects/HelloWorldAndroid/HelloWorldAndroid/HelloWorldAndroid.csproj", true); | ||
|
||
var xtcApiKey = context.CakeContext.TransformTextFile ("../xtc-api-key").ToString (); | ||
var xtcEmail = context.CakeContext.TransformTextFile ("../xtc-email").ToString (); | ||
|
||
try { | ||
// Run testcloud | ||
context.CakeContext.TestCloud (apk, | ||
xtcApiKey, | ||
"2b9b256d", | ||
xtcEmail, | ||
"./TestProjects/HelloWorldAndroid/HelloWorldAndroid.UITests/bin/Debug/", | ||
new TestCloudSettings { | ||
ToolPath = testCloudExePath | ||
}); | ||
|
||
context.CakeContext.UITest ("./TestProjects/HelloWorldAndroid/HelloWorldAndroid.UITests/bin/Debug/HelloWorldAndroid.UITests.dll", | ||
new Cake.Common.Tools.NUnit.NUnitSettings { | ||
ToolPath = testCloudExePath | ||
}); | ||
} catch (Exception ex) { | ||
Console.WriteLine (ex); | ||
Console.WriteLine (context.GetLogs ()); | ||
Assert.Fail (context.GetLogs ()); | ||
} | ||
} | ||
} | ||
} | ||
|
4 changes: 4 additions & 0 deletions
4
Cake.Xamarin.Tests/TestProjects/HelloWorldAndroid/.nuget/packages.config
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NUnit.Runners" version="2.6.4" /> | ||
</packages> |
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
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
5 changes: 3 additions & 2 deletions
5
Cake.Xamarin.Tests/TestProjects/HelloWorldAndroid/HelloWorldAndroid.UITests/packages.config
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,5 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NUnit" version="2.6.3" targetFramework="net45" /> | ||
<package id="Xamarin.UITest" version="0.7.1" targetFramework="net45" /> | ||
<package id="NUnit" version="2.6.4" targetFramework="net45" /> | ||
<package id="NUnit.Runners" version="2.6.4" targetFramework="net45" /> | ||
<package id="Xamarin.UITest" version="1.0.0" targetFramework="net45" /> | ||
</packages> |
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
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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
d0cf24c6c683dc634dfef19be22fee6b |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
[email protected] |