Replicate battery Charging/Discharging Unit Test in Android Studio

130 views Asked by At

I am developing an Android app in which I have certain broadcast receiver that will will be broadcasting whenever the state of device is changed from discharging to charging and charging to discharging.

I have tested this functionality on the device physically and found that it is working as needed. Now, I wish to write unit test cases for the same.

1.How do I replicate the charging discharging scenario ? Incase I would be using AVD, the device would be charging always and incase I use device, for discharging the device needs to be disconnected, the device would be disconnected and test case would not run.

How do I successful complete the test case where in I would be able to toggle the test cases.

0

There are 0 answers