add test for CI

master
cldupland 6 years ago
parent fefaf352d7
commit 3f4e96d7e1

@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TheGameExtreme.iOS", "TheGa
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TheGameExtreme", "TheGameExtreme\TheGameExtreme.csproj", "{8DE6C881-FF77-4CC4-B8C4-CDEDD9AB13B3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -53,5 +55,17 @@ Global
{8DE6C881-FF77-4CC4-B8C4-CDEDD9AB13B3}.Debug|iPhone.Build.0 = Debug|Any CPU
{8DE6C881-FF77-4CC4-B8C4-CDEDD9AB13B3}.Release|iPhone.ActiveCfg = Release|Any CPU
{8DE6C881-FF77-4CC4-B8C4-CDEDD9AB13B3}.Release|iPhone.Build.0 = Release|Any CPU
{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}.Release|Any CPU.Build.0 = Release|Any CPU
{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}.Debug|iPhone.Build.0 = Debug|Any CPU
{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}.Release|iPhone.ActiveCfg = Release|Any CPU
{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}.Release|iPhone.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

@ -0,0 +1,42 @@
using System;
using System.IO;
using System.Linq;
using Xamarin.UITest;
using Xamarin.UITest.Queries;
namespace test
{
public class AppInitializer
{
public static IApp StartApp(Platform platform)
{
// TODO: If the iOS or Android app being tested is included in the solution
// then open the Unit Tests window, right click Test Apps, select Add App Project
// and select the app projects that should be tested.
//
// The iOS project should have the Xamarin.TestCloud.Agent NuGet package
// installed. To start the Test Cloud Agent the following code should be
// added to the FinishedLaunching method of the AppDelegate:
//
// #if ENABLE_TEST_CLOUD
// Xamarin.Calabash.Start();
// #endif
if (platform == Platform.Android)
{
return ConfigureApp
.Android
// TODO: Update this path to point to your Android app and uncomment the
// code if the app is not included in the solution.
//.ApkFile ("../../../Droid/bin/Debug/xamarinforms.apk")
.StartApp();
}
return ConfigureApp
.iOS
// TODO: Update this path to point to your iOS app and uncomment the
// code if the app is not included in the solution.
//.AppBundle ("../../../iOS/bin/iPhoneSimulator/Debug/XamarinForms.iOS.app")
.StartApp();
}
}
}

@ -0,0 +1,34 @@
using System;
using System.IO;
using System.Linq;
using NUnit.Framework;
using Xamarin.UITest;
using Xamarin.UITest.Queries;
namespace test
{
[TestFixture(Platform.Android)]
[TestFixture(Platform.iOS)]
public class Tests
{
IApp app;
Platform platform;
public Tests(Platform platform)
{
this.platform = platform;
}
[SetUp]
public void BeforeEachTest()
{
app = AppInitializer.StartApp(platform);
}
[Test]
public void AppLaunches()
{
app.Screenshot("First screen.");
}
}
}

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.6.3" targetFramework="net472" />
</packages>

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{72B8F38B-0C7B-4F91-9C48-AB4054B1EE16}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>test</RootNamespace>
<AssemblyName>test</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Tests.cs" />
<Compile Include="AppInitializer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="view\" />
<Folder Include="viewmodel\" />
<Folder Include="model\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
Loading…
Cancel
Save