Test Strategy
In the previous sections, we understood how to build and deploy app on an Android device. See here for refresher
Note: We are talking about outside-in tests here. Inside-out i.e. unit tests involves only a developer, with CI we intend to get the maximum value as perceived by the end consumer. Hence the tests mentioned below are integration/end-end tests.
Continuous Test Automation - with Cucumber
You can really choose any testing framework you would like, as an example I chose cucumber (with ruby) because it lets me describe the "what" piece (features) first. Then I write the "how" layer (step definitions) i.e. the technical piece later. In my experience, I felt this gives a good collaboration experience with multiple roles. Anyways, if you are a developer and you are working in a silo, choose whatever fits your need (Junit, rspec, testng et al.). Below links are to help you understand cucumber basics
- Why Cucumber
- ATDD,BDD,TDD
- Continuous Test Automation
- How Cucumber works
- Install Cucumber
- Cucumber Keywords
- Step Definitions
- Basic Tutorial - For web
We are not going to explain Cucumber and its fundamentals and will assume that you have a basic understanding with the above links
High Level Mindmap
Our high level explanation of the code you are going to see in the next few sections is as below
- Your android build process puts the app-debug.apk in ./features/support/resources folder
- Write Cucumber features
- Complete the context code (env.rb and hooks.rb)
- List your target devices in devices.yaml
- List your target emulators in emulators.yaml
- Define a module that returns desired capabilities object (representing the device/emulator) to talk to Appium Server
- default cucumber profile writes html and json results
- Write tests and tag them so that appPackage and appActivity are defined both for the app to be tested and generic settings on Android device (settings needn't be tested actually, however we have this example to get started)