I'm trying to test my app's behavior in various situations like let's say there's a lot of RAM and CPU being used or network being consumed by some other apps or battery being drained away by another.
Now, what I've is let's say I want (100-X)% of RAM to be used away(render unavailable) and my app has only X% to use, how can I simulate that and run my app in that condition?
Similarly, let's say I've only Y% of network available due to various other apps running on the system, now I want to render (100-Y)% of the network availability to be simulated and run my app in that condition.
CPU being busy for (100-Z)% and available only Z% of time for my app that I want to test.
These are the situations that I want to simulate. Can someone show me a tool or explain me a way to do this?
Your requirement is that you want to test the application under stressed or release condition which can be controlled by you. so here the solution which I can see is
You can develop one more application(background service mostly) which would be responsible for increasing or decreasing the CPU cycles, Occupying or Releasing Memory and keep the network busy by the network operation(make simple UI to give the inputs)
CPU cycles : Create multiple threads which would do Float operations and consume lot many CPU cycles and can be keep on the sleep when not required
Memory : Need to write the C code(malloc to allocate the memory to pointers) and access that through the JNI and function to release the same. use the memory function from java to monitor current usage
Network : Make task to download huge amount of files from dropbox or other server when needed and monitor the state as required.
after this configuration run the service, launch the desired application and test out under that condition.