Xamarin.UITest.SpecFlowPlugin 0.3.0

Install-Package Xamarin.UITest.SpecFlowPlugin -Version 0.3.0
dotnet add package Xamarin.UITest.SpecFlowPlugin --version 0.3.0
<PackageReference Include="Xamarin.UITest.SpecFlowPlugin" Version="0.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Xamarin.UITest.SpecFlowPlugin --version 0.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Xamarin.UITest.SpecFlowPlugin, 0.3.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Xamarin.UITest.SpecFlowPlugin as a Cake Addin
#addin nuget:?package=Xamarin.UITest.SpecFlowPlugin&version=0.3.0

// Install Xamarin.UITest.SpecFlowPlugin as a Cake Tool
#tool nuget:?package=Xamarin.UITest.SpecFlowPlugin&version=0.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Xamarin.UITest.SpecFlowPlugin

Unofficial SpecFlow plugin for Xamarin.UITest. I decided to create this plugin to remove the need for boiler-plate code, outlined here, when creating a new feature. This plugin will remove the need to:

  • Have a BaseTestFixture class that is used to create and start Xamarin.UITest
  • Manually creating a partial test fixture with the appropriate NUnit.TestFixtureAttribute for each desired platform

This is achieved by taking advantage of SpecFlow feature tags and replacing the default NUnit.TestFixtureAttribute on the generated test fixture.

Getting Started

  1. The first thing to do is to install the SpecFlow extension for Visual Studio:

  2. Create a new Xamarin.UITest Cross-Platform Test Project

  3. Install the SpecFlow.NUnit NuGet package

  4. Now you can install the Xamarin.UITest.SpecFlowPlugin package

  5. Create an AppManager class at the root of your UI test project. This is going to be the bridge between the SpecFlow generated test fixture and Xamarin.UITest

    • Add the following two methods:

      public static void Start(Xamarin.UITest.Platform platform)
      {
          // Configure Xamarin.UITest e.g.
          if(platform == Platform.Android)
              ConfigureApp.Android.StartApp()
          else
              ConfigureApp.iOS.StartApp();
      }
      
      public static void Shutdown()
      {
          // Run any shutdown logic required between scenarios
      }
      
  6. Create a new feature file using the SpecFlow file template

  7. Add a supported tag above the feature title. This is how Xamarin.UITest.SpecFlowPlugin will pick up on which platforms to add as test fixture attributes. The following tags are supported:

    • @uitest will add both Platform.iOS and Platform.Android as test fixtures
    • @uitest:ios will add Platform.iOS as a test fixture attribute
    • @uitest:android will add Platform.Android as a test fixture attribute
    • Any other tags will be treated as normal SpecFlow feature tags

    Example:

    @uitest
    Feature: UITest category fixture generation 
        Simple calculator for adding two numbers
    
    Scenario: Add two numbers
        Given the first number is 50
        And the second number is 70
        When the two numbers are added
        Then the result should be 120
    

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.0 1,672 8/23/2021