Error in executing the Xamarin.UITest for some reason

807 Views Asked by At

I am trying to do UI Testing using the Xamarin.UITest framework. I am trying to follow the procedure using the links that is given on their website.The application is named 'CreditCardValidator'. I downloaded the app and then did stuffs like upgrading the UITest package and not the NUnit package. As the tutorial mentions that the code that is to be mentioned is

using System;
using System.IO;
using System.Linq;
using NUnit.Framework;
using Xamarin.UITest;
using Xamarin.UITest.iOS;
using Xamarin.UITest.Queries;

namespace CreditCardValidator.iOS.UITests
{
    [TestFixture]
public class Tests
{
    iOSApp app;

    [SetUp]
    public void BeforeEachTest()
    {
        Console.WriteLine ("Starting the function");

        app = ConfigureApp.iOS.StartApp();

//          app = ConfigureApp.iOS.AppBundle("/Users/admin/Library/Developer/CoreSimulator/Devices/57DBB268-714A-473F-A7D3-C3B4BB2BB138/data/Containers/Bundle/Application/A9151B5D-7B9C-4F9A-9EF2-F153AC994170").StartApp();
        Console.WriteLine ("ending the function ");
    }


    [Test]
    public void CreditCardNumber_TooShort_DisplayErrorMessage()
        {

        Console.WriteLine ("Starting the function");

        app.WaitForElement(c=>c.Class("UINavigationBar").Marked("Simple Credit Card Validator"));

        app.EnterText(c=>c.Class("UITextField"), new string('9', 15));


        Console.WriteLine ("ending the function ");

        }
    }
}

MY PROBLEM : The simulator is not opening and the tests are failing for no reason. The StartApp() functions documentation says that it LAUNCHES the app on the simulator. The error I am getting in the Test Results pad is

SetUp : System.NullReferenceException : Object reference not set to an instance of an object

They are failing at the line : app = ConfigureApp.iOS.StartApp();

enter image description here

I tried to replace this line with the compiled version of the app which is commented out in the code. But for that still the simulator is not opening and the error I am getting is SetUp : System.Exception : App bundle directory doesn't contain a valid app bundle. Still the error is at the Startup function line

enter image description here

MORE INFO : In the second attempt I found that my .app file has a 'STOP' image on it. Could this be the reason ? enter image description here

Please ask if more information is required.

0

There are 0 best solutions below