gpt4 book ai didi

Xamarin.UITests ApkFile 或 InstalledApp 尚未在 VS 中配置

转载 作者:行者123 更新时间:2023-12-02 13:48:13 26 4
gpt4 key购买 nike

我在 Visual Studio 中启动了一个新的 Xamarin 跨平台应用程序项目。

这只是您在 VS studio 中获得的模板。我已经在 Android 模拟器和真实 Android 设备上测试构建此应用程序,并且运行良好。启动欢迎使用 Xamarin Forms!

主要目的是在当前解决方案中将 Xamarin Test Cloud 与 Xamarmin.UITests 结合使用。

所以我在解决方案中添加了一个新项目(UI Test App(跨平台))。它还具有用于测试屏幕启动的模板。我已添加对 .IOS 和 .Android 项目的引用。

当我运行选定的测试时。我收到以下错误 ApkFile 或 InstalledApp 尚未配置

if (platform == Platform.Android)
{
return ConfigureApp
.Android
.StartApp();
}

这应该打包设备上的 .Droid 项目启动并运行测试。我还确保未在 .Droid 项目的 Android 选项中选择使用共享运行时间。

如果我从外部引用 APK,这可以工作,但这不是我希望的工作方式。这应该适用于前面的内容,采用当前项目并运行测试。

 if (platform == Platform.Android)
{
return ConfigureApp
.Android
.ApkFile(@"C:\Users\frasera\Documents\Visual Studio 2017\Projects\App6\App6\App6.Android\bin\Debug\App6.Android.apk")
.StartApp();
}

最佳答案

看起来在某些情况下可能需要这样做。请参阅:https://developer.xamarin.com/guides/testcloud/uitest/working-with/running-tests-in-ide/#Running_Android_6.0_Applications_from_the_IDE

When the IDE installs an Android 6.0 app for the first time, it does not grant all permissions required by the application. The workaround for this is to use UITest to install and start the application:

ConfigureApp.Android.Debug().ApkFile(apkpath).StartApp ()

Do use ApkFile() and do not use PreferIdeSettings(). This will force UITest to install instead of the IDE.

关于Xamarin.UITests ApkFile 或 InstalledApp 尚未在 VS 中配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42856962/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com