cancel
Showing results for 
Search instead for 
Did you mean: 

Testcomplete not "see" object of Android app in "Object Browser" after "adb shell am force-stop"

NikitaPyatakov
Occasional Contributor

Testcomplete not "see" object of Android app in "Object Browser" after "adb shell am force-stop"

Hi All!

 

I ran into the following problem:

If I run the "adb shell am force-stop <PACKAGE>" command while the script is running and run the Android app again with the "am start-n yourpackagename/.activityname" command, then the app is no longer visible in the "Object Browser" tab.

 

Two points are also known:
1. the command " ... am force-stop .. "stops all child processes associated with the running package, which means that "your "(with the prefix". tctest") application also stops working

2. When I start the application via "TestComplete", then " TestComplete":
2.1 repackages "my" app in " packege.name-signed. apk"
2.2 creates an additional application "instrumentation-signed. apk" ("your")
2.3 installs these two apps on the device while removing the two apps from the computer at the same time
2.4 somehow runs both apps, so that "my" re-packaged app will run through " yours"

 

So I have questions:

1. What is the best way to stop the app so that the connection between "my" re-packaged app and "your" app is not lost?

2. If I have "my" repackaged application and "your" application, in what order and with what commands do I need to launch the applications so that after launching "my" repackaged application, the objects are visible on the "Object Browser" tab?

 

P.S.

Suggestion:
make a human work with the tested Android application from the "TestedApp" module-give opportunities:
1. Launch the app (with a full cycle of operation)
2. Run only the app (without instrumentation, just run and that's it)
3. Deploy the app (with a full cycle of operation) without starting
4. Deploy only (without instrumentation, just deploy and that's it)
5. Stop the app (just stop and that's it)
6. Restart the app (just restart and that's it)
7. Delete the app (just delete and that's it)


Let this functionality be available only from the script.

 

P.P.S.

My env:

PC: Win10x64, ru

Android Studio: 4.0.1 x64

TestComplete: 14.71 x64

 

Thanks!

10 REPLIES 10
sonya_m
Community Manager

Re: Testcomplete not "see" object of Android app in "Object Browser" after &quot

Thank you for posting the question!

 

@AlexKaras  @Marsha_R , do you have any ideas?


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
NikitaPyatakov
Occasional Contributor

Re: Testcomplete not "see" object of Android app in "Object Browser" after &

 Could you check with the development team in Tula? they know better in what order to stop and set

P.S.
They know this trite because they somehow created a mechanism for installing and restarting the application from TestComplete

Marsha_R
Community Hero

Re: Testcomplete not "see" object of Android app in "Object Browser" after &

For the original question, I would ask Support directly

https://support.smartbear.com/message/?prod=TestComplete

 

For the suggestion, I would add a feature request

https://community.smartbear.com/t5/TestComplete-Feature-Requests/idb-p/TestXCompleteFeatureRequests

AlexKaras
Community Hero

Re: Testcomplete not "see" object of Android app in "Object Browser" after &quot

Hi,

 

@AlexKaras  @Marsha_R , do you have any ideas?

I will check with the current 14.71 version of TestComplete and let you know the result.

What worked for me previously:

-- '... am force-stop ...' to stop application;

-- PackManagerObj.RemovePackage(PackObj, False); to remove the package;

-- PackManagerObj.InstallPackage(PackObj, true); to install the package;

-- http://blog.falafel.com/instrumenting-android-apps-ii/, http://blog.falafel.com/instrumenting-android-apps-iii/ to check if the application was properly instrumented;

-- '... am start -n <process>/<activity>' or PackManagerObj.LaunchPackage(PackObj); to start application;

-- app.Instrument(); to (re-)instrument tested application.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
C-Hansen
Occasional Contributor

Re: Testcomplete not "see" object of Android app in "Object Browser" after &

Hi everyone,

 

Have you figured out a solution to this problem or have you heard from Smartbear, because I was thinking about opening a support ticket about this issue.

 

There is definitely something that has changed, with the new way instrumentation works in 14.70 and 14.71. At least I didn't have the issue on 14.61 and before that.

 

We have used the adb force-stop command for a long time followed by LaunchPackage method without any issues, but now we have noticed the same thing as described by OP. After a force-stop the only way of getting TestComplete to notice the objects again seems to be to reinstall the app. Not even manually opening the app on the phone works.

 

However I've also seen the issue without actively doing a force-stop command. Before I could instrument the app and it would just work. I could go a whole work day debugging and testing on that app. However now I notice that I often need to reinstall the app because TestComplete can't see the objects. I'm not sure when it happens, might be after a crash of the app, the system killing the app by itself or something else. After it happens there seem to be no way of launching the app again without a reinstall.

 

Thanks.

 

NikitaPyatakov
Occasional Contributor

Re: Testcomplete not "see" object of Android app in "Object Browser" after &

2 C-Hansen

 

adb force-stop command - this command kills the process itself and all its child processes - that's why we don't see objects

 

This is because your application is called through the TestComplete agent on the device while running the application with the prefix ". tctest" as a child process of your main application

 

Kulibins...

 

C-Hansen
Occasional Contributor

Re: Testcomplete not "see" object of Android app in "Object Browser" after &

Thank you @NikitaPyatakov.

 

That gives me an idea about the cause but what about the solution? Is the only solution to reinstall the app then or did you get any information on this?

 

For example: Can you call an ADB command with the prefix, add the prefix in the parameter to the LaunchPackage method or something?

 

Otherwise I would at least like a way from TestComplete to launch the app in the needed state without reinstalling it.

sonya_m
Community Manager

Re: Testcomplete not "see" object of Android app in "Object Browser" after &

Hi @NikitaPyatakov ! Thank you for sharing this info. I couldn't find your support case, what's the solution for this as provided by our support team?

Thank you!


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
C-Hansen
Occasional Contributor

Re: Testcomplete not "see" object of Android app in "Object Browser" after &

@sonya_m Did you figure out something?

 

I'm thinking of writing a support ticket myself, if you can't find the answer to my latest question.

 

Thanks,

New Here?
Join us and watch the welcome video:
Top Kudoed Authors