I want to run Android tests for my App even if the cable is disconnected from machine.
Scenario:
I start Android tests from Android studio.
The tests take long time to finish.
The cable sometimes get disconnected (for many reasons) then the tests break.
I have to reset test data
Repeat from the beginning
However, I want my tests to keep running until they finish all test cases regardless of being connected to Android Studio.
I'm assuming the question is more about running tests on physical device. If that's the case, you may want to consider adb over tcp: https://developer.android.com/studio/command-line/adb#wireless however you will end up with another problem: your device will need to be charged from time to time, which basically means plugging your device anyways. Thus I'd suggest using Firebase test lab if that's an option: https://firebase.google.com/docs/test-lab. Last time I was checking, there was free tier for that.
Related
I'm developing an Android Things application on the iMX7D development board and I have implemented Google's Nearby services. The issue I have is that I get an error (sometimes) when I begin advertising the device. Here is the error:
com.google.android.gms.common.api.ApiException: 17: API: Nearby.CONNECTIONS_API is not available on this device.
I have managed to fix the error by following the instructions on https://stackoverflow.com/a/51428433/6377151, and that allows the code to run fine. The error gets fixed if I run the ADB command
adb shell am force-stop com.android.iotlauncher.ota
And then run the application, but that only works for the one time. As soon as the device is rebooted, the issue comes back. I'm aware that this is because the default launcher is already advertising the device, but I'm not sure how to fix this issue in code automatically when my application runs. But I need a way to either do this automatically on startup or to overcome the error in another way.
My Android Things device is running Android Things 1.0.10. Can anyone assist?
Disclaimer: I work on Nearby.
We have a release ready to allow multiple apps to advertise/scan at the same time. It's code-complete, but code pushes are slow at Google. It'll be a while before it's public. Note: Android Things boards might need to be reflashed to get the update. That was the case in development, but is hopefully not the case for release builds.
In the meantime, you'll unfortunately have to either install another launcher, or force stop the existing one. We treat clients as first-come-first-serve.
I have a Android device which I keep connected with my Jenkins server(through USB) which basically run my automation every day at a specified time but every now and then I keep running into problems where device starts to loose charge overnight or when I am remotely accessing(Vysor) the device and run some automation tests on it , it starts to loose and eventually die down. I am looking for suggestion to keep my device up and running 24/7 without loosing charge when I am running my automation cases.
I had tried all of the options you mentioned. I am now using powered USB hub which keeps it charging on power 24/7.
There are some things that you can do to keep your Android device from going to sleep.
enable developer mode (I assume you have done that already since you
are running automatic tests).
on settings->developer menu turn USB
debugging on (again I assume this is already done)
on settings->developer menu turn on Stay Awake so that the display
never goes to sleep when the device is charging.
It may also be that the issue is with your device. In that case I suggest you try the same thing with some mainstream Android phone and see if the behavior differs.
Below are some common problem encountered when performing tests using Appium with Selenium - especially when running the tests for hours.
Some common Problems are:
sometimes midway into the tests, appium cannot connect to the Device. Logs say Device is offline (even though the device is online & app is accessible, manually)
sometimes midway into the tests, the chromedriver in the case of webview becomes unresponsive.
Questions:
Keeping the Device Constant - Is there a way to restart the Appium Server and connect it to the existing instance of the Android Device. This way i can resume tests where it abruptly stopped.
Keeping the Appium Server Constant - Is there a way to restart the APP on the Android Device and connect it to the existing instance of the Appium Server Session.
Is there some way to CHECK whether Appium Server and/or Android Device is offline / unresponsive ?
You can check whether device is offline w.r.t appium by hitting adb devices in the command prompt.
If it displays the device only then its online to appium server
If Server becomes unresponsive it might be an intermittent stale session issue. Better to stop and restart server from command prompt by hitting adb kill-server && sudo adb start-server
Few things can help you in minimising these issues drastically:
0. Put no lock and no screen saver on device.
1. Always start appium server before starting all tests, in case of testNG/junit framework, start in #BeforeClass or #BeforeTest method.
2. add this capabilities.setCapability("newCommandTimeout", "120") to appium driver, this will stop appium to timeout early thus avoiding nosessionfound exception etc.
3. assuming you are using appium v16 and latest chromedriver v20:
Problem: Chromedriver normally hangs while switching to and from webview but appium waits for chromedriver to respond until defined timeout and if it doesn't respond, appium gets timeout and then you may see hell lot of new issues like device not online, unknown error etc.
Solution: You can keep monitoring chromedriver, when it stops responding, you can start it programmatically, this way your test will get going.
Readymade solution: Download chromedriverhandler.jar from
1. https://github.com/mi2pankaj/chromeDriverHandler, add to your project,
2. use this in beforeTest/beforeClass or at the start of your test: ChromedriverHandler.chromeDriverHandlerThread().start();
3. use this in afterTest/afterClass or at the end of your test: ChromedriverHandler.chromeDriverHandlerThread().stop();
Hope this helps!!
I'm having an incredibly frustrating time using Android Studio with wearable devices.
The problem is that when I try to run or debug the wearable app Android Studio doesn't do anything most of the time, it hangs there with the last message being
"Waiting for process: com.name of my wearable app".
I can get it to work maybe 10% of the time, then it stops and I might be messing around for 40 minutes before I can get it to work again.
I don't have any issues at all using Android Studio to debug the phone part of the app, its only the wearable part.
Once its stopped working then 1) restarting the watch doesn't fix it, 2) restarting abd doesn't fix it, 3) restarting Android Studio doesn't fix it, 4) manually killing the app process on the watch doesn't fix it. The only thing that will work is to reset the watch. However the entire process of resetting the watch, re-pairing, re-running AS takes about 15 minutes and then afterwards AS will only permit interactive debugging a few times before it stops again. I can't reset the watch everytime AS throws a tantrum, its too time consuming and making my blood pressure rise to dangerous levels.
Something I've frequently noticed is if I try and exit Android Studio it asks: "Do you want to disconnect from the process 'wear'? and if I select the disconnect button then it just sits then and Android Studio never quits.
This is driving me absolutely insane, does anybody please have any experience using the Android Studio debugger with a wearable and has any suggestions how I can some sort of reliability.
Its AS version 1.1.0, using with Lollipop.
Note the wearable app starts/launches/runs perfectly if I'm not using Android Studio, so I don't think there are any issues with the app itself.
******* UPDATE **********
Just updated to AS 1.1.0 today and when trying to debug the wearable it popped up a dialog saying it was unable to open the debugger port
.
popped up a dialog saying it was unable to open the debugger port .
Check the port number. It should be same as in JAVA_OPTIONS and AS Debugger remote configuration under port no.
in command prompt run this :
ping 127.0.0.1:8601
check port 8601 not in firewall list
or used by another program
I have the following problem:
My phones USB port is broken and I have no way of running app on the phone other than sending it over bluetooth and install it every time I make changes to the code. So every time I make changes, I gotta spend min+ to see them in action. I don't want to use emulator.
Is there a way I can make eclipse run my app on the phone over the internet when I build/run the app the same way it does over USB? Thanks!