【问题标题】:Xamarin.UITest on iOS : Second and subsequent Tests failes as all the app.<Methods> throws exceptionsiOS 上的 Xamarin.UITest:第二次和后续测试失败,因为所有应用程序。<Methods> 引发异常
【发布时间】:2019-08-11 23:41:22
【问题描述】:

使用 Xamarin.UITest 框架测试 Xamarin.Forms 应用程序,到目前为止,所有测试用例都在 Android 模拟器上运行良好,但在 iOS(模拟器)中,大多数测试用例都失败,除了第一个 Test.That 有时也会失败,无法正确预测。

对于每个测试,应用程序都成功启动并且登录屏幕可见,但测试抛出异常,无法对 UI 元素执行任何操作。

我使用了 REPL,tree 命令显示正确的树,但如果我尝试任何应用程序。 Tab、EnterText、ClearText、flash...等方法抛出异常。

执行 EnterText(Id("Usern2meAutoId"), "test@test.com") 时出错 异常:System.Exception:无法输入文本。查询 Id("Usern2meAutoId") g2ve 没有结果。

2t X2m2rin.UITest.iOS.iOSApp+c__Displ2yCl2ss21_0.b__0 () [0x0004c] in :0 2t X2m2rin.UITest.Utils.ErrorReporting.With (System.Action func, System.Object[] 2rgs, System.String memberN2me) [0x00006] in :0

异常:执行 EnterText(Id("Usern2meAutoId"), "test@test.com") 时出错


System.Exception : 执行 W2itForElement(M2rked("FullN2meAutoId"), "没有看到 l2nding p2ge.", 00L00L15, null, null) 时出错 ----> System.TimeoutException : 没有看到 l2nding p2ge -

【问题讨论】:

    标签: xamarin xamarin.forms xamarin.ios xcuitest xamarin.uitest


    【解决方案1】:

    显然 Xamarin.UITest 与 iOS 测试似乎是已知问题。

    为每个测试重新启动模拟器可以解决问题。 并且取消选中模拟器中的“连接到硬件键盘选项”也很重要。

    公共类 AppInitializer { public static IApp StartApp(平台平台) { 如果(平台 == Platform.Android) { 返回 ConfigureApp.Android.StartApp(); }

        Environment.SetEnvironmentVariable("UITEST_FORCE_IOS_SIM_RESTART", "1"); // <----  Add this line
    
        return ConfigureApp.iOS.StartApp();
    }
    

    }

    https://forums.xamarin.com/discussion/149966/xamarin-uitest-does-not-clean-my-app-on-ios/

    【讨论】:

      猜你喜欢
      • 2019-06-11
      • 1970-01-01
      • 1970-01-01
      • 2020-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-09
      • 2021-03-19
      相关资源
      最近更新 更多