0

我们正在对我们的 Android 和 IOS 应用程序的测试云进行调查。我制作了一个安装和启动安卓应用程序的测试片段。然后截图。我正在使用 Visual Studio 编写测试。和 Visual Studio 模拟器运行 android 应用程序和 xamarin 测试。Xamarin 测试能够安装应用程序,但随后引发错误。代码和错误可以在下面找到。

其他观察:

  1. 我正在使用免费 30 天的测试帐户进行调查。
  2. 但我没有在链接中看到我的计算机:https ://store.xamarin.com/account/my/subscription/computers 。同时,我已经从我的 PC 中的 Visual Studio 登录。
  3. 因此,我也无法复制许可证文件。这可能是原因吗?如果是,那么在没有完全订阅的情况下进行调查的最佳方法是什么。

代码:

[TestFixture]
public class Tests
{
        AndroidApp app;
        [SetUp]
        public void BeforeEachTest()
        {
            // TODO: If the Android app being tested is included in the solution then open
            // the Unit Tests window, right click Test Apps, select Add App Project
            // and select the app projects that should be tested.
            app = ConfigureApp
                .Android
                // TODO: Update this path to point to your Android app and uncomment the
                // code if the app is not included in the solution.
                .ApkFile(@"C:\MobileOnly\SampleProjects\AndroidSampleProjects\InfraTest\app\build\outputs\apk\app-debug.apk")
                // .InstalledApp("com.microsoft.mobile.infratest")
                .StartApp(Xamarin.UITest.Configuration.AppDataMode.Clear);

        }

        [Test]
        public void AppLaunches()
        {
            app.Screenshot("First screen.");
        }
    }

错误:

Test Name: AppLaunches
Test FullName: XamarinUITest.Tests.AppLaunches
Test Source: : line 0
Test Outcome: Failed
Test Duration: 0:00:11.233

Result StackTrace:
at Xamarin.UITest.Shared.Processes.ProcessRunner.Run(String path, String arguments)
at Xamarin.UITest.Shared.Android.Commands.CommandAdbInstallPackage.Execute(IProcessRunner processRunner, IAndroidSdkTools androidSdkTools)
at Xamarin.UITest.Shared.Android.LocalAndroidAppLifeCycle.InstallApps(ApkFile[] apkFiles)
at Xamarin.UITest.Shared.Android.LocalAndroidAppLifeCycle.EnsureInstalled(ApkFile appApkFile, ApkFile testServerApkFile)
at Xamarin.UITest.Android.AndroidApp..ctor(IAndroidAppConfiguration appConfiguration)
at Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp(AppDataMode appDataMode)
at XamarinUITest.Tests.BeforeEachTest() in C:\MobileOnly\SampleProjects\AndroidSampleProjects\XamarinUITest\XamarinUITest\Tests.cs:line 22
Result Message: 
SetUp : System.Exception : Failed to execute: C:\NugetCache\androidsdk.23.0.4\platform-tools\adb.exe -s 169.254.138.177:5555 install "C:\Users\gunjansa\AppData\Local\Temp\uitest\a-6EAAB1A4CD21F05DB755FBC781EAD620D4ADACBC\final-D9BA1DA5963F9B7853DABC6DEC56BFF2F4740ADE.apk" - exit code: -1073740940
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.

包:/data/local/tmp/final-D9BA1DA5963F9B7853DABC6DEC56BFF2F4740ADE.apk

4

2 回答 2

0

更新 Xamarin.UITest NuGet 并尝试

public void BeforeEachTest()
        {
            // TODO: If the Android app being tested is included in the solution then open
            // the Unit Tests window, right click Test Apps, select Add App Project
            // and select the app projects that should be tested.
            app = ConfigureApp
                .Android
                .StartApp();
}
于 2016-07-05T17:00:22.030 回答
0

我会做以下动作

  1. 恢复你的 UITest 项目包
  2. 确保您没有看到任何以包 ID 命名的应用程序,尽管该应用程序已从设备上完全卸载。通常情况下,uitests 会卸载应用程序的现有版本并留下导致此问题的文件夹。

希望这能解决您的问题。

于 2016-09-02T15:04:22.037 回答