Reputation: 39
I'm running an automated test script using AndroidViewClient. I do several dumps in the script. The script is used for a speed/response time test on an android device and the test is run for n>300. I get the following error at run #150.
raise ValueError("received does not contain valid XML: " + receivedXml) ValueError: received does not contain valid XML: Killed
After some digging and monitoring the memory using "memory_profiler", The dump data seems to be stacking up on the memory and slow down the test and influence the test results.
1- Why do I get the error? 2- Where exactly the dump data is stored? 2- How to clear the memory every time I dump?
Upvotes: 0
Views: 669
Reputation: 69358
What you describe seems like an issue with uiautomator dump
(probably your device implementation) which is what AndroidViewClient uses as the default backend for API >= 19.
However, to be absolutely sure you should remove AndroidViewClient from the picture and run the same command it is used as the backend.
AndroidViewClient 12.0.2 supports some debug options specified in the command line, one it's very useful to determine the command being run.
$ dump --debug UI_AUTOMATOR:True > /dev/null
this command will print something like
executing 'uiautomator dump --compressed /dev/tty >/dev/null'
then this is the command you can run repeatedly to determine if the problem is in your device.
For example, copying the command printed before you can use bash
to run
for n in {0..299}; do echo $n; adb shell uiautomator dump --compressed /dev/tty \>/dev/null >/dev/null; done
and check if there's a memory leak or something fails on the device.
Regarding your question and as you can see from the command, dump data is not stored anywhere and only copied to the socket. There are versions that require the data to be stored locally on the device but in such case the file used is overwritten every time.
Upvotes: 1