locked
Are the tests created in Xamarin.UITest executable only for "debug" release of app? RRS feed

  • Question

  • User395396 posted

    Hi, I am trying to create some tests for mobile app created with xamarin.forms. I am using Xamarin.UITest for that. In every test I am launching our application. However it seems like Xamarin.UITest can only open application which was released in "debug" mode. If I provide APK which is was released in "release" mode, app is not started at the beginning of the test(it just gives an error). Is that intentional? Can Xamarin.UITest interact only with "debug" version of the app? When tests will be executed later on, those should be executed on "release candidate" of the app, so app would be in "release" not debug. Will that work?

    Monday, September 28, 2020 1:22 PM

Answers

  • User369979 posted

    Yes, it can. How did you test the app under the release mode? You could try to archive your application in the release mode to get the .apk. And then test the apk directly using the file path: return ConfigureApp .Android .EnableLocalScreenshots() .ApkFile(apkFilePath) .StartApp(Xamarin.UITest.Configuration.AppDataMode.Auto); If it has been signed, add

    .KeyStore(keyStoreFile, storePassword, keyPassword, keyAlias)
    
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, September 29, 2020 8:31 AM

All replies

  • User369979 posted

    Yes, it can. How did you test the app under the release mode? You could try to archive your application in the release mode to get the .apk. And then test the apk directly using the file path: return ConfigureApp .Android .EnableLocalScreenshots() .ApkFile(apkFilePath) .StartApp(Xamarin.UITest.Configuration.AppDataMode.Auto); If it has been signed, add

    .KeyStore(keyStoreFile, storePassword, keyPassword, keyAlias)
    
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, September 29, 2020 8:31 AM
  • User395396 posted

    @LandLu Thank you for your answer. It helped a bit, I've got to another error. Failure [INSTALLFAILEDINVALID_APK: Failed to extract native libraries, res=-2]

    However I didn't add .KeyStore part. Because it was not recognized. Do I need to make definition somewhere, what actually KeyStore is?

    Thank you.

    Tuesday, September 29, 2020 11:13 AM
  • User369979 posted

    [INSTALLFAILEDINVALID_APK: Failed to extract native libraries, res=-2] This issue is caused by your apk. Could it be installed by your device directly? Try these approaches: https://forums.xamarin.com/discussion/184125/install-failed-invalid-apk-failed-to-extract-native-libraries-res-2 Add it in the application: <application ... android:label="@string/app_name" android:extractNativeLibs="true" However I didn't add .KeyStore part. If you want to publish your application to the store, it must be signed with keystore. You could find it through

    Wednesday, September 30, 2020 5:32 AM
  • User395396 posted

    @LandLu
    Thanks. Adding android:extractNativeLibs="true" to AndroidManifest helped. Application now starts even in non-debug mode. Keystore part, I know where it is, but when I write ".Keystore" to "ConfigureApp", it is not being accepted (it is not recognized). However it works also without it so that is good. Thank you.

    Wednesday, September 30, 2020 6:38 AM