如何 运行 Xamarin UI 在 Android 模拟器上测试
How to run Xamarin UI tests on Android emulator
如何 运行 Xamarin UI 在 Android 模拟器上测试?
我总是 运行 我在真实设备上进行测试,但是对于 CI 我需要在模拟器上进行测试,但我不知道如何 google 没有给我具体的答案
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
我强烈建议您通读有关此主题的完整文档,因为有一些 "gotchas" 需要根据您的情况考虑:
https://developer.xamarin.com/guides/testcloud/uitest/intro-to-uitest/
如何 运行 Xamarin UI 在 Android 模拟器上测试? 我总是 运行 我在真实设备上进行测试,但是对于 CI 我需要在模拟器上进行测试,但我不知道如何 google 没有给我具体的答案
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
我强烈建议您通读有关此主题的完整文档,因为有一些 "gotchas" 需要根据您的情况考虑:
https://developer.xamarin.com/guides/testcloud/uitest/intro-to-uitest/