Bahmni Connect Testing
- Vinay Venkatachala
- Teresa Gracias
- Abishek Anand
- Santhosh Bairam
This section explains how testing can be done for the offline features both on Android as well as Chrome extension.
Setup Bahmni Connect by following the instructions here
Using Charles tool for network throttling
Introduction
Charles is a HTTP proxy tool which can be used to intercept the network traffic from the client (Android device or Chrome browser) and the Bahmni server and apply different profiles on it to simulate various network conditions. Though Chrome can be used for network throttling on Chrome browser which helps in testing of Chrome extension, for the purposes of uniformity across Android app and Chrome extension, it is suggested to use Charles for testing. Also, the current version of Chrome does not support network throttling for remote debugging of mobile web views. Please download the tool from http://www.charlesproxy.com/download/.
Usage and configuration
Steps to do on Mac (similar steps apply for Windows) which acts as a proxy
- Open Charles tool and go to Proxy menu and select Mac OS X Proxy. This configures proxy settings on Mac. Allow Charles to do if it prompts for permissions.
- Go to Proxy menu and select Proxy Settings. Here, in the Proxies tab, Enable transparent HTTP proxying. Leave the port number as 8888 which is the default port on which Charles runs.
- Go to Proxy menu and select SSL Proxying Settings. In the SSL Proxying tab, Enable SSL Proxying. Thereafter, add locations for which this proxying has to be enabled. You can either give the IP address of the device for which proxying has to be applied or apply it to all by using wild chars (*:*).
- Go to Proxy menu and select Access Control Settings. This is required to authorize the devices to use this proxy. Here, you can give the IP address of the device just to make sure that, you are applying network settings only to the device you want.
Steps to do on Android device
- Visit http://charlesproxy.com/getssl from any mobile browser and download and install the certificate. Or, you can go to Help menu in Charles and then select Save Root Certificate. This will bring up a file selector dialog. Save the certificate in an appropriate location. Copy this certificate to the device. Navigate to the location where this certificate is saved on the device and click on it which will trigger installation of certificate.
- Configure the proxy ip/hostname and port in the network settings of the chosen network. Note that the ip address is the address of the machine on which Charles is running and port is 8888 by default.
(Note: You can modify the network settings by following the steps - Settings App → Network → Long press on the appropriate network name → Modify Network)
Network throttling configuration
The following steps are suggested to do testing with different network presets-
- In Charles tool, go to Proxy menu and select Throttle Settings. Enable Throttling and apply this for Only selected hosts.
- Add the hosts for which throttling has to be applied.
- Either use the already present presets or define your own custom presets. The following configuration is suggested for simulating a not so good 2G cellular network-
- Bandwidth of 256 kbps (both upload and download)
- Utilisation of 100%
- Latency of 300 ms
- MTU of 1500 bytes
- Reliability of 75%
- Stability of 75%
- Unstable quality range of 20% to 25%
- Similarly other presets can be defined.
- For complete offline mode, the bandwidth can be set to 0.
Automation test setup for Chrome app
Basically the existing functional test scenarios will cover most of the bahmni features in web application. For bahmni to support offline usage we have android app and chrome extension. We made changes to automate the test set up for chrome extension.
echo "deb https://download.go.cd /" | sudo tee /etc/apt/sources.list.d/gocd.list curl https://download.go.cd/GOCD-GPG-KEY.asc | sudo apt-key add -sudo apt-get update sudo apt-get install go-agent wget -N http://chromedriver.storage.googleapis.com/2.20/chromedriver_linux64.zip sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
sudo apt-get install xvfb
The Bahmni documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)