Most of the time I thought Automation only possible for functional testing. Now, Appium supports non-functional testing like testing of connectivity while automation script execution. Here, I would like to show the capability of Appium to do connectivity testing of Android Native applications. The connectivity testing includes:
- WiFi
- Mobile Data
- Airplane
HasNetworkConnection interface support setting the connectivity while test script execution. If you are declared the driver as WebDriver then you need to cast the driver with HasNetworkConnection interface. Following are the different connectivity testing actions:
Set WiFi connection on mobile native Android
((HasNetworkConnection) driver).setConnection(Connection.WIFI);
Set Mobile Data connection on mobile native Android
((HasNetworkConnection) driver).setConnection(Connection.DATA);
Set Airplane mode on mobile native Android
((HasNetworkConnection) driver).setConnection(Connection.AIRPLANE);
Set both WiFi and Mobile Data on mobile native Android
((HasNetworkConnection) driver).setConnection(Connection.ALL);
Turn-off both WiFi and Mobile Data on mobile native Android
((HasNetworkConnection) driver).setConnection(Connection.NONE);
To understand the current connectivity on mobile native Android
((HasNetworkConnection) driver).getConnection();
Try to use all the above actions in your Automation scripts whenever you automate mobile native Android.
make it perfect !
Leave a Reply