Test Framework
The test framework we use is based on Cucumber, Ruby, Appium_lib gem. Hence we describe the "what" in features/scenarios and "How" in the code-behind (step_definitions). This aligns very well with ATDD (acceptance test driven development).
Git Repo
Below is the git repository used for demonstrating test automation in this book.
CI Android Acceptance Tests Repository
Folder Structure
- ci_android_acceptancetests is the cucumber project root
- features folder contains features
- step_definitions folder contains the code behind. In our case it has two ruby files. There can be any number and spread across files
- support folder is standard cucumber support folder i.e. the code in this folder is executed when cucumber process starts
- resources folder contains app-debug.apk, which is the output of build process
- env.rb is generally the file where we require modules for cucumber project and any other context to be loaded
- hooks.rb contains the pre and post conditions for scenarios. You can as well put this in env.rb, however by convention we use hooks
- ci_android.feature contains our scenarios or tests
- lib folder is defined by this framework to store the code that is mixed in. It also contains configuration definitions for devices and emulators
- devices.yaml contains devices definitions
- emulators.yaml contains emulator definitions
- capabilities.rb contains the module that returns desired capabilities object
- screen_helper.rb module is for future use to apply page object pattern
- scripts folder is to quickly test something before we formalize it in features. Not necessary, but I iterate here sometimes writing quick snippets of code
- contact_screen.png was screenshot taken by one of the scenarios
- cucumber.yml is the configuration file for cucumber
- example.mp4 was the screen capture taken when executing the scenario (See adb tutorial section on how to take screen recording)
- Gemfile contains the gems used in this project
- Gemfile.lock is created when we run bundle install
- Rakefile is not used at this point, though we can define higher level tasks
- README.md contains readme for this project
- reports.json is the json formatted output of cucumber
- reports.html is the html formatted output of cucumber