Hi folks, Today I’m going to explain how to test the mobile apps native(with hybrid I faced challenges like id is displaying as empty and we have to follow WebView and this WebView is different for different frameworks) using the testing frame work Calabash in Ruby. Calabash is a free open source project,developed & maintained by Xamarin.You can get additional information at GitHub repository: https://github.com/calabash The following tools are required to test the mobile app.
- Android SDK
Now follow the below steps: Step 1: Open ruby and check for the version you are using.For this type the below command in your Ruby command prompt. ruby -v Install the below listed gems : calabash-android, calabash-common ,calabash-cucumber, calabash-extras cucumber ,cucumber-core ,gherkin(2.12.2 ruby x86-mingw32) ,gherkin-ruby, io-console, motion-calabash, multi_json, retriable, rspec rspec-core, rspec-expectations, rspec-mocks, rspec-support ,gametel And type gem list in Ruby command prompt to view the list of gems installed in your machine.
Step 2 : Install Android SDK and create a virtual devise inorder to test the app in emulator else you can plug android devise to system to check on your devise. To list all the devises attached to the system type the below command : adb devices
Step 3: Configuring Environmental Variables 1.Right click on My Computer and select Properties. 2.Select Environment variables>Create new variable 3.Put varaible name as ANDROID_HOME and set variable value as Android SDK path i.e (c:\foldername\sdk). 4.Set the value as JAVA_HOME variable value as JAVA JDK folder.
Now your testing environment is ready so lets get started with the testing process. 1.First make a directory and paste the apk file of the mobile application in that directory.
2.Create a gem file and copy the gem list in that file as below and type the below command in the ruby command prompt bundle exec install or bundle install. Gemfile.lock file will be generated in that folder after executed the above command.
3.Now open the command prompt and you are in the folder of you application. And run the below command calabash-android gen This command will generate a skeleton folder structure consisting features and sub folders as shown below. Now go to the command prompt and type the below command to get the apk signed. calabash-android resign
Here the test server is created for the application and now we have to install the app into the emulator or the devise for that use the below command in console. >reinstall_apps
The app is installed into your emulator or devise successfully, if you get any errors try to uninstall the app or try with the same command again because sometimes the app building gets failed due to delay in app starting. Find my_first.features file in features folder and write the test cases here and execute using the below commands on emulator or devise. 4. Now exit from console and type the below command in the command line to run the test case. calabash-android run If you want the detailed report saved as html file then use the below command. calabash-android run -f html -o test-result.html
The test report is saved in the application folder you can view the report on the browser.