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?
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.
PC: Win10x64, ru
Android Studio: 4.0.1 x64
TestComplete: 14.71 x64
sonya_m, Could you check with the development team in Tula? they know better in what order to stop and set
They know this trite because they somehow created a mechanism for installing and restarting the application from TestComplete
For the original question, I would ask Support directly
For the suggestion, I would add a feature request
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.
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.
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
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.
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?
@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.