Skip to content

Latest commit

 

History

History
178 lines (135 loc) · 4.66 KB

README.md

File metadata and controls

178 lines (135 loc) · 4.66 KB

Cake.AppleSimulator.SushiHangover

Build status

Cake Build addin for managing (simctl) Apple iOS/watchOS/TV simulators.

##Nuget:

PM> Install-Package Cake.AppleSimulator.SushiHangover

Ref: https://www.nuget.org/packages/Cake.AppleSimulator.SushiHangover/

Installation

Add the following reference to your cake build script:

#addin "Cake.AppleSimulator.SushiHangover"

Additional Features

This variant of Cake.AppleSimulator adds additional features to allow unit testing on simulator:

  • InstalliOSApplication
  • UninstalliOSApplication
  • LaunchiOSApplication
  • TestiOSApplication

xUnit/NUnit for Devices Testing

Review unitest.cake on performing xUnit/NUnit for Devices testing...

There are two core Tasks (with supporting Action-based aliases) that show the basics:

  • UnitTestingFailExample
  • UnitTestingPassExample

Unit testing on the iOS Simulator boils down to a fairly simple Task:

Task("UnitTestingFailExample")
    .IsDependentOn("RunningOnMacOS")
    .IsDependentOn("RestorePackages")
    .Does (() =>
{
    buildThisApp(
        "./src/Test.NUnit/Test.NUnit.csproj",
        "UnitTesting",
        "Clean"    
    );
    buildThisApp(
        "./src/Test.NUnit/Test.NUnit.csproj",
        "UnitTesting",
        "Build"    
    );
    unitTestApp(
        "cake.applesimulator.test-nunit",
        "./artifacts/Test.NUnit.app"
    );
});

##Original Documentation:

Usage

// erase/factory reset, then power on an iPhone 6.3 simulator running iOS 9.3 and then shut it down.
IReadonlyList<AppleSimulator> simulator = ListGenymotionSimulators();

var simulator = simulators.First(x => x.Name == "iPhone 6s" & x.Runtime == "iOS 9.3");
var deviceIdentifier = simulator.UDID;

EraseAppleSimulator(deviceIdentifier);

// launch simulator currently does not block, you will need to sleep the cake
// thread for enough time to allow the simulator to boot.
LaunchAppleSimulator(deviceIdentifier);

using System.Threading;
Thread.Sleep(15000);

ShutdownAllAppleSimulators(deviceIdentifier)

Administration

void EraseAppleSimulator(string deviceIdentifier);
void BootAppleSimulator(string deviceIdentifier)
void LaunchAppleSimulator(string deviceIdentifier)
void ShutdownAllSimulators();

List defined simulators

IReadonlyList<AppleSimulator> ListAppleSimulators();

public sealed class AppleSimulator
{
    public string Availability { get; set; }
    public string Name { get; set; }
    public string Runtime { get; set; }
    public string State { get; set; }
    public string UDID { get; set; }
}

List defined simulator pairings

IReadonlyList<AppleSimulatorPair> ListAppleSimulatorPairs();

public sealed class AppleSimulatorPair
{
    public string State { get; set; }
    public string UDID { get; set; }
    public AppleSimulatorPairedPhone Phone { get; set; }
    public AppleSimulatorPairedWatch Watch { get; set; }
}

public sealed class AppleSimulatorPairedPhone
{
    public string Name { get; set; }
    public string State { get; set; }
    public string UDID { get; set; }
}

public sealed class AppleSimulatorPairedWatch
{
    public string Name { get; set; }
    public string State { get; set; }
    public string UDID { get; set; }
}

List installed simulator runtimes

IReadonlyList<AppleSimulatorRuntime> ListAppleSimulatorRuntimes();

public sealed class AppleSimulatorRuntime
{
    public string Availability { get; set; }
    public string BuildVersion { get; set; }
    public string Identifier { get; set; }
    public string Name { get; set; }
    public string Version { get; set; }
}

List installed simulator devicetypes

IReadonlyList<AppleSimulatorDeviceType> ListAppleSimulatorDeviceTypes();

public sealed class AppleSimulatorDeviceType
{
    public string Identifier { get; set; }
    public string Name { get; set; }
}

The future

The infrastructure for the following is in place but not implemented, open an issue on GitHub, discuss and then send in a PR. Cheers!

  • Add video/photos to asset libary.
  • Install application onto simulator.
  • Uninstall application from simulator.
  • Launch application on simulator.
  • Configure simulator to disable keyboard autocorrect/etc
  • Configure simulator graphics quality.
  • Configure simulator window scale.
  • Retrieve physical location on disk of the simulator's app container.
  • Trigger an iCloud sync.
  • Pair an iPhone+Watch.
  • Unpair an iPhone+Watch.
  • Open URL on a simulator.