AppInitializer始终启动android进行跨平台测试 [英] AppInitializer always launches android for cross platform tests
问题描述
我正在编写一个UI测试,该测试应该是Android和IOS之间的跨平台.
I'm writing a UI Test that is supposed to be cross platform between Android and IOS.
当我在Mac上运行App Initializer时,即使我打开了iOS模拟器且未插入Andorid的iOS设备,平台" Xamarin对象也始终解析为android(在调试模式下运行测试时已确认)模拟器或连接的设备.
When I run my App Initializer on a Mac, the "platform" Xamarin object always resolves as android (confirmed when running the tests in debug mode) even though I have an iOS simulator open and an iOS device plugged in with no Andorid simulators or devices connected.
public static IApp StartApp(Platform platform)
{
if (platform == Platform.Android)
{
return ConfigureApp
.Android
.ApkFile("../../Binaries/Android/com.xamarin.samples.taskyandroid.apk")
.StartApp();
}
return ConfigureApp
.iOS
.AppBundle("../../Binaries/iOS/TaskyiOS.app")
.DeviceIdentifier("Device id")
.StartApp();
}
我唯一可以启动iOS模拟器的时间是在不评估平台的情况下注释掉if条件.
The only time I can launch an iOS simulator is when I comment out the if condition without evaluating platform.
如何获取appinitializer来将iOS检测为平台?
How can I get the appinitializer to detect iOS as the platform?
感谢您的想法.
推荐答案
请确保您正在Unit Tests
(XS)或Test Explorer
(VS)窗口中针对所需的操作系统运行测试
Ensure that you are running your tests for the desired OS, from the Unit Tests
(XS) or Test Explorer
(VS) window
-
Xamarin Studio
>>View
>>Pads
>>Unit Tests
-
Visual Studio
>>Tests
>>Test Explorer
Xamarin Studio
>>View
>>Pads
>>Unit Tests
Visual Studio
>>Tests
>>Test Explorer
如果您使用Play / Run
按钮,而UITest项目被选择为Startup Project
,或者如果您使用Run All
,我相信platform
将默认为Android(从Android开始,因为它出现在iOS之前)
I beleive platform
will default to Android if you use the Play / Run
button, while the UITest project is selected as the Startup Project
, or if you use Run All
(starting with Android since it appears before iOS)
(哇,那张图片很大,很抱歉)
这篇关于AppInitializer始终启动android进行跨平台测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!