Forum Discussion

AdamRyś's avatar
AdamRyś
Occasional Contributor
5 years ago

Android Object Testing - On-Screen Action "Drag..." option doesn't recognize objects anymore

Hi,

 

I started Android application tests in TestComplete. I was struggling with devices and application preparation to start with object test. I did everything the same like here it was written: https://support.smartbear.com/testcomplete/docs/app-testing/mobile/android/preparing/index.html

- Computer recognizes my device (Android 10 - Huawei Mate 20 Lite)

- I got enable TestComplete Android Agent on this device

- Testcomplete saying that application which I trying to test is already instrumented

- After I click on "Show Mobile Screen", I see my device and my app on it.

I tried to use "On-Screen Action" opperation with "Drag the target.." few times unsuccessfully. After this I clicked "Point and fix" option and I pressed (Ctrl+Shift+A) - that was a moment when I finally saw objects from application in those red rectangles. I prepared few actions on this app and next to it I run test (I had on my "actions queue" firstly "Run TestedApp" and below this, only "On-screen actions"). Application re-installed and test failed. I tried one more time do "On-Screen action" where i select objects, but since then I can't find out how to select objects instead of whole application screen when I use "On-screen action". 

 

Please help.

Adam

  • I got answer from support:
    "Our developers determined why the issue occurs - your app uses the controls which are not supported (androidx), and when TestComplete instruments such an app, it doesn't take into account the code which these controls add. Thus, we will need to make quite complex changes to the instrumentation process, this could take significant time - currently, we don't have any ETA when or whether we support such type of Android apps."


    They recomended anyway to instument my application by PatchServices.jar from source code: 
    https://support.smartbear.com/testcomplete/docs/app-testing/mobile/android/preparing/instrumenting-apps/ide/android-studio.html

    My developers added this .lib and it finally starts recognize my objects in app :).

    So if your application uses "androidx" controls, instrumentation in TestComplete will be not enough, you will need do this by adding PatchServices.lib in source code.

     

    Kind regards,

    Adam Ryś

     

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi Adam,

     

    Sounds wierd...

    Can you let us know what language/technology your tested application was created with?

    Also, you mentioned, that your tested application was re-deployed to the device on test start. Your Tested Aplication item must point to the instrumented version of the .apk file. (Or you need to do instrumentation from test code.) Can you double-check that instrumented application was re-deployed to the device?

     

    • AdamRyś's avatar
      AdamRyś
      Occasional Contributor

      AlexKaras Thanks for quick response!

       

      App was created in Kotlin. I checked a lot of times if app is instrumented, since I know this is a key to object-based testing in TestComplete. It always returns "Your Android application is already instrumented". Screenshot attached.

       

      Kind regards,

      Adam

       

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        App was created in Kotlin.

        I think that this might be the reason of the unstable access to application's internals that you are experiencing. (I assume that device is prepared for testing as documented -- developer mode is on, etc. -- and has TestComplete agent installed.)

        I don't remember anyone here talking about Kotlin, thus I would recommend to create Support ticket via the https://support.smartbear.com/message/?prod=TestComplete form.

        I also would appreciate it if you update this thread and let us know the result of your communication with Support.