locked
UI test System.Exception RRS feed

  • Question

  • User309598 posted

    Hello! I try to Execute some simple UI tests on Xamarin Android.

    _AppInitializer _:

    public static IApp StartApp(Platform platform)
        {
            if (platform == Platform.Android)
            {
                return ConfigureApp
                    .Android
                    .ApkFile(@"D:\DEMO UI\DemoApp\DemoApp\DemoApp.Android\bin\Release\com.companyname.DemoApp.apk")
                    .StartApp();
            }
            return ConfigureApp
                .iOS
                .StartApp();
        }
    

    Tests:

    IApp app;
        Platform platform;
    
        public Tests(Platform platform)
        {
            this.platform = platform;
        }
        [SetUp]
        public void BeforeEachTest()
        {
            app = AppInitializer.StartApp(platform);
        }
        [Test]
        public void ButtonClick()
        {
            app.Tap("Mybutt");
            var labelresult = app.Query("Mylabel").First(result => result.Text == "New text");
            Assert.IsTrue(labelresult != null, "correct UI result");
        }
    

    But when I click Run selected text then got a message :

    Message: SetUp : System.Exception : Failed to execute: C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 install -g "C:\Users\Name\AppData\Local\Temp\uitest\a-35C99D3B2B84FFBF5EA16C49D8C264A148107FF6\final-BD39EFD80A0C98583FA77A85C7E24A8C14BDF412.apk" - exit code: 1
    Failed to install C:\Users\Name\AppData\Local\Temp\uitest\a-35C99D3B2B84FFBF5EA16C49D8C264A148107FF6\final-BD39EFD80A0C98583FA77A85C7E24A8C14BDF412.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
    

    How can I fix it ? Thanks!

    Thursday, March 29, 2018 1:18 PM

Answers

  • User309598 posted

    It work for me:

    1) First one - You must use the Release not Debug.

    2) Go to the Properties of you Project in Solution - alt+Enter(in my case it was DemoApp.Android).

    2.1) take off the Use Shared runtime

    2.2) in Linker Properties set Sdk assembly only

    2.3) Advanced -> Supported architectures : select x86_x64; x86; armeabi-v7a;

    3) Then rebuild solution and you *.apk file.

    4) start android emulator

    5) start you UI test

    Hope this help someone else.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, March 29, 2018 2:22 PM