How to Test Android App Under Low Disk Memory Conditions? - testing

All mobile devices have limited storage options. Therefore, it is imperative for a tester to test an app under low memory conditions. To simulate these conditions, a tester has to fill device memory using dummy files. This is very tedious and time consuming process.
Is there any app or any proper steps to overcome this situation..!!

If you're using emulator to perform test execution have variety of options to control memory availability (both RAM, internal storage and SD card) Just limit the size of the memory type you need to the application size + 5% and you'll get "low memory" environment
There are also other ways already present at Stack Overflow on how to simulate memory shortage. See links below:
How can I force memory pressure for Android debugging?
How do you simulate low memory in the Android emulator?

You can specify the VM Heap parameter when creating the AVD. However, for a real device it doesn't look like you can change the parameters.

Related

How to detect low performance device in runtime react native

I want to detect low performance device in runtime in react native to disable complex lottie animation. I consider for use device model from react-native-device-info, but I should have a list of heigh performance phones
I'm also interested in this question and it would be fine to have some solution. I can think of using react-native-device-info and comparing following properties of device:
CPU architecture (32/64 bit)
total RAM available
total disk capacity
current android version
Maybe using these variables we are able to calculate some performance level with not that bad accuracy.
64bit + lets say at least 3GB RAM + 32GB capacity + one of newer Android version can be good indication that device should have some power inside.
on the other hands 32bit + 1/2GB RAM + max 8/16GB capacity + not that new Android version can lead to performance prblms.
Seriously let's talk about it :D Maybe we can find some good compromise and maybe write a lib or contribute to react-native-device-info with a feature that will try to suggest developers about device's performance.
consider use android version
we use this formula:
low android version === old phone === low performance
performance can be low if device is out of memory, too many applications opened, which browser used, etc... its hard to detect
when is neccesary, you can write small performance test in app before animations or on app load/initialization, and you can use these results.
It's possible to run any benchmark in background using web worker or use library like fireball-js, then compare the score.

Advanced GPU Control needed for browserwindows

I would like to set how much GPU RAM is being used as to prevent the app from overflowing on windows. Does anyone have any expert advice?
I am using electron to build an automatic player for windows. This player plays a mix of video's (h264encoded mp4), html and jpeg based on a schedule (sort of like a presentation).
I tested the app on several windows devices, the results vary greatly!
All devices are tiny computers by Asus. In general I noticed 2 distinct differences:
On devices that have no hardware acceleration the chromium gpu process uses up about 30MB of shared RAM, this number never changes, regardless of the content played. The CPU however has all the load here, meaning it is decoding the mp4's (h264) with software instead of hardware.
On devices with hardware acceleration the cpu load is of course less, but the RAM memory used up by the chromium gpu-process varies greatly. While displaying jpeg or html the RAM is about 0.5GB, when mp4'skick in the RAM memory easily goes up to 2GB and more.
On the stronger devices without hardware acceleration this is not a big issue, they have 8GB of shared memory or more and don't crash. However some of the other devices have only 4GB of shared memory and can run out of memory quite easily.
The result of this lack of memory is either the app crashes completely (message with memory overflow is displayed) or the app just hangs (keeps running but doesn't do anything anymore, usually just displays a white screen).
I know that I can pass certain flags to browserwindow using app.commandLine.appendSwitch.
These are a few of the flags that I tried and the effect they had, I found a list of them here:
--force-gpu-mem-available-mb=600 ==> no effect whatsoever, process behaves as before and still surpasses 2GB of RAM.
--disable-gpu ==> This one obviously worked but is undesirable because it disabled hardware acceleration completely
--disable-gpu-memory-buffer-compositor-resources ==> no change
--disable-gpu-memory-buffer-video-frames ==> no change
--disable-gpu-rasterization ==> no change
--disable-gpu-sandbox ==> no change
Why are some of these command line switches not having any effect on the GPU behaviour? All devices have onboard GPU and shared RAM. I know the Command Line Switches are being used on startup because when I check the processes in the windows task manager I can see the switches have been past to the processes (using the the command line tab in the task manager). So the switches are loaded but still appear to be ignored.
I would like to set how much GPU RAM is being used as to prevent the app from overflowing on windows. Does anyone have any expert advice?

How does memory use affect battery life?

How does memory allocation affect battery usage? Does holding lots of data in variables consume more power than performing many iterations of basic calculations?
P.S. I'm working on a scientific app for mac, and want to optimize it for battery consumption.
The amount of data you hold in memory doesn't influence the battery life as the complete memory has to be refreshed all the time, whether you store something there or not (the memory controller doesn't know whether a part is "unused", AFAIK).
By contrast, calculations do require power. Especially if they might wake up the CPU from an idle or low power state.
I believe RAM consumption is identical regardless of whether it's full or empty. However more physical RAM you have in the machine the more power it will consume.
On a mac, you will want to avoid hitting the hard drive, so try to make sure you don't read the disk very often and definitely don't consume so much RAM you start using virtual memory (or push other apps into virtual memory).
Most modern macs will also partially power down the CPU(s) when they aren't very busy, so reducing CPU usage will actually reduce power consumption.
On the other hand when your app uses more memory it pushes other apps cache data out of the memory and the processing can have some battery cost if the user decides to switch from one to the other, but that i think will be negligible.
it's best to minimize your application's memory footprint once it transitions to the background simply to allow more applications to hang around and not be terminated. Also, applications are terminated in descending order of memory size, so if your application is the largest one existing in the background, it will be killed first.

IOS process internals - how to get information?

I am looking for an API to monitor the tasks running on a plain iPhone (no jailbreak). Those are about:
look for CPU usage (my main concern).
look for memory usage.
look for disk usage (how many read/write)
look for network usage (how many bytes sent and received by network: 3G, Wifi, GSM).
is it possible to rely on the IOS simulator running on a Mac (or should I test my application directly on the device)?
I think I can look into the system C libraries (sigint, etc.) but I am not sure to be able to retrieve this information except for the current applications running. I know some monitor applications run on the global usage but I would like to be able to find the information process by process.
If someone can provide some links or something useful, I will start a deeper investigation then.
CPU usage can be found by looking at the code from this related question:
iOS - Get CPU usage from application
Memory usage:
Available memory for iPhone OS app
And here are a couple threads that talk about how to find out about the applications or tasks currently running:
Can we retrieve the applications currently running in iPhone and iPad
How to get information about free memory and running processes in an App Store approved app? (Yes, there is one!)
How to get the active processes running in iOS
The answers to these questions may point you in the direction you'd like to head towards.
Good luck!
The Activity Monitor should get you what you're looking for. You should be able to observe RAM, CPU, and VRAM usage for each iOS process. This is a default tool installed with xCode. Very handy.

Differences in Mobile and Desktop Application Testing

How would you test a ‘Mobile’ version of IM? What are some key differences between testing this version versus a desktop application?
First of all you need to account for unstable connectivity - the program should be ready to deal with temporary and permanent network coverage losses.
Resources consumption (memory footprint, network bandwidth and CPU time) is also to be considered. Noone wants a program that drains the battery in an hour, occupies all memory or causes a giant bill to the owner.
Both memory requirement and network bandwidth has to be kept to as low as possible...
adding to sharptooth's answer, notifications on sending/receiving a message. Support for voice chat/video chat via available hardware :)