Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Xamarin forms UITest

v3yr0nv3yr0n USUniversity ✭✭

I'm trying use app.Invoke in a XF UITest app.
I've followed the instructions from here: https://developer.xamarin.com/guides/testcloud/uitest/working-with/backdoors/
In my AppDelegate I have the
[Export("methodName:")]
public NSString MethodName(NSString arg){
return new NSString("method");
}

And in the UITest class I have:
[Test]
public void AppLaunches ()
{
app.Invoke ("methodName","val");
}

Error while performing Invoke("methodName", "val")
Exception: System.Exception: Invocation failed: The backdoor: 'methodName' is undefined
at Xamarin.UITest.iOS.iOSApp+c__AnonStorey27.<>m__0 () <0x4861b40 + 0x00137> in :0
at Xamarin.UITest.Utils.ErrorReporting.With[T] (System.Func`1 func, System.Object[] args, System.String memberName) <0x48617e8 + 0x00034> in :0

Any help?

Thanks!

Posts

  • JohnHardmanJohnHardman GBUniversity admin

    @v3yr0n - It's been a while since I've used UITest backdoors, but could it be that public NSString MethodName uses "Method", but everywhere else you have "method"?

    I seem to recall having fun with that colon as well whilst getting tests to work on both Android and iOS, but cannot remember off the top of my head whether it was really required in the end.

    BTW - you might want to post this question in the Insights forum at https://forums.xamarin.com/categories/xamarin-insights

  • v3yr0nv3yr0n USUniversity ✭✭

    Well, what happened was, someone from the xamarin team introduced an error. This is a temporary bug and will be solved shortly, according to xamarin support.
    To solve the issue for now, until xamarin releases a new version, we should call app.Invoke ("methodName:","val"); notice the ":"

    Thanks!

Sign In or Register to comment.