gpt4 book ai didi

android - 如何在 Android 模拟器上运行 Xamarin UI 测试

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:45:00 26 4
gpt4 key购买 nike

如何在 Android 模拟器上运行 Xamarin UI 测试?我总是在真实设备上运行我的测试,但对于 CI 我需要在模拟器上测试,但我不知道如何并且谷歌没有给我一个具体的答案

public class AppInitializer
{
private const string ApkPath = @"..\..\..\mob\mob.Droid\bin\Release\myApp.apk";
private const string AppPath = "mob.iOS.app";

public static IApp StartApp(Platform platform)
{
if (platform == Platform.Android)
{
return ConfigureApp
.Android
.EnableLocalScreenshots()
.ApkFile(ApkPath)
.StartApp();
}

return ConfigureApp
.iOS
.EnableLocalScreenshots()
.StartApp();
}
}

最佳答案

在文档中,@tequilaslammer 简要提到:

Unlike testing on iOS, Xamarin.UITest will not automatically start the Android Emulator. It is necessary to have an Android emulator running or an Android device already connected. If there is more than one device or emulator connected, it will be necessary to provide the serial ID of the device/emulator that should be used to run the test.

来源:https://developer.xamarin.com/guides/testcloud/uitest/intro-to-uitest/#Initializing_AndroidApp

我强烈建议您通读有关此主题的完整文档,因为您的情况需要考虑一些“陷阱”:

https://developer.xamarin.com/guides/testcloud/uitest/intro-to-uitest/

关于android - 如何在 Android 模拟器上运行 Xamarin UI 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41595398/

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