Contents tagged with Xamarin.UI Test

  • Setup User Interface Automation Testing with Xamarin.UI Test

    Xamarin.UITest is a testing framework that enables Automated UI Acceptance Tests written in NUnit to be run against iOS and Android applications. It integrates tightly with Xamarin.iOS and Xamarin.Android projects using Xamarin.Forms. Xamarin.UITest is the Automation Library that allows the NUnit tests to execute on Android and iOS devices. The tests interact with the user interface just as a user would, enter text, tapping buttons, and performing gestures – such as swipes.
    Typically, each UITest is written as a method that is referred to as a test. The class which contains the test is known as a test fixture. The test fixture contains either a single test or logical grouping of tests and is responsible for any setup to make the test run and any cleanup that needs to be peformed when the test finishes. Each test should follow the Arrange-Act-Assert pattern:
    Arrange – The test will setup conditions and initialize things so that the test can be actioned.
    Act – The test will interact with the application, enter text, pushing buttons, and so on.
    Assert – The test examines the results of the actions performed in the Act step to determine correctness. For example, the application may verify that a particular error message is displayed.
    We will also discuss how to use the REPL included with Xamarin.UITest to explore the views on a screen and to automate interactions with the application.
    Xamarin.UITest requires NUnit 2.6.3 or higher. Xamarin.UITest is not compatible with NUnit 3.0.
    Only Android and iOS applications are supported. It is not possible to test Windows Phone applications.
    It is possible to test Android applications with Visual Studio on Windows or Xamarin Studio on Mac OS X. To run an Android test it is necessary to have a .APK file. It is also necessary to have the JDK and the Android SDK installed. In most cases these will be automatically installed by the Xamarin.Android installer.