【发布时间】:2014-11-21 15:34:33
【问题描述】:
我无法在任何 Android 模拟器/模拟器上运行 Xamarin.UITests。有什么建议么?尝试时出现以下错误:
谷歌模拟器:
SetUp:System.Exception:未经激活无法在物理设备上运行。 完整版可供 Xamarin 测试云客户使用,有关更多信息,请联系 sales@xamarin.com 如果您已经是 Xamarin Test Cloud 客户,您可以通过以下方式之一提供您的 api: * 使用 ApiKey 方法添加它 ConfigureApp * 设置 XTC_API_KEY 环境变量 * 将以下属性添加到您的 Properties/AssemblyInfo.cs 文件:[程序集:Xamarin.UITest.TestCloudApiKey(YOUR_API_KEY)] * 将包含您的 api 密钥的 xtc_api-key 文件放在测试程序集的上游目录中
Xamarin Android 播放器:
设置:System.Exception:未连接设备
GenyMotion:
SetUp:System.Exception:执行失败:/users/erikandersen/Library/Developer/Xamarin/android-sdk-macosx/platform-tools/adb devices - 退出代码:1 无法绑定 'tcp:5037' ADB 服务器没有 ACK * 无法启动守护进程 * 错误: adb 服务器已过期。杀戮……
将 GenyMotion 更新到 2.3.1 后,我现在收到以下错误:
SetUp: System.Exception: App Installation failed with output: 12050 KB/s (11199602 bytes in 0.907s) 包:/data/local/tmp/final-xxxxxx.apk 失败[INSTALL_FAILED_CPU_ABI_INCOMPATIBLE]
NUnit 代码
AndroidApp _app;
public string PathToAPK { get; set; }
[TestFixtureSetUp]
public void BeforeAll ()
{
var path = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath;
var info = new FileInfo(path);
var directory = info.Directory.Parent.Parent.Parent.FullName;
PathToAPK = Path.Combine(directory, "Android", "bin", "Debug", "Demo.Android.apk");
}
[SetUp]
public void BeforeEach ()
{
_app = ConfigureApp.Android.ApkFile (PathToAPK).StartApp ();
}
[Test]
public void TestInvalidEmail ()
{
_app.EnterText (c => c.Class ("UITextField"), "");
}
TestInvalidEmail() 永远不会被调用,因为 NUnit 失败了
_app = ConfigureApp.Android.ApkFile (PathToAPK).StartApp ();
背景:
我正在将 Xamarin.UITests 用于我正在开发的 iOS/Android 应用程序,但我们遇到了 Android 方面的问题。 iOS 工作正常。我为每个测试编写了两次,一次在 C# 中,一次在 Ruby 中使用葫芦,以隔离问题。 Calabash 工作正常,但任何 C# NUnit 测试项目都无法连接到我尝试启动的任何模拟器。
我尝试过的:
- 在我运行测试之前确保模拟器已经在运行
- 确保只有 1 个模拟器在运行
- 重启 adb 服务器
- 尝试多种类型的模拟器(即 Xamarin Android Player、Gennymotion 和 Google 模拟器)
【问题讨论】:
标签: android android-emulator xamarin nunit ui-testing