1. Enrich Your Mobile Automation
With
Visual Assertions
http://clipartzebraz.com/cliparts/eye-clipart/cliparti1_eye-clipart_10.jpg
Rajdeep Varma
Sr. Consultant, ThoughtWorks
2. About Myself
• Rajdeep Varma
• 6 years in Quality Engineering. I work at
ThoughtWorks
• Active open source contributor
• Passionate about test automation and agile practices
• Tested a number of web apps and recently started
testing mobile apps
3. I will talk about
• The Problem: Limitation of functional testing tools
and Need of Automated visual regression.
• Our Approach: “Nakal”
• Some Challenges and solutions
• Future Plans
8. The Problem
• UI changes done for App-1, frequently
break UI of App-2
• There is no automated regression to
catch this!
9. Tech Radar
• CSS Critic
• dpxdt
• Huxley
• PhantomCSS
• Wraith
NOT FOR
MOBILE
10. Options
• Manual UI regression against past build:
Error prone.
It SUCKS!
• Proprietary cloud based tools
• Create a tool that meets our need
http://images.clipartpanda.com/choice-clipart-fork-choice-hi.png
11. My Need
• No new framework. Use existing tests.
• Easy to extend any test for visual validations
• Easy to integrate in our CI
• On-premise and easy to debug failures locally
15. How it works?
• ADB for capturing screen on android.
• AppleScript for capturing iOS Simulator
screenshots
• ImageMagick for comparison
16. Installation and Configuration
•Install ImageMagick
•Include in Gemfile
gem ‘nakal'
•In env.rb or any equivalent file:
require “nakal/cucumber" OR require "nakal" ; include Nakal::DSL
Nakal.platform = :androidOR Nakal.platform = :ios
17. To add visual assertion
nakal_execute(“home_screen")
•For the very first time, to create baseline, run your
test with environment variable
NAKAL_MODE=build
•Now onwards, run your test with environment
variable NAKAL_MODE=compare
18. Some Improvements
• Implicit wait till current screen matches baseline
• Mask a dynamic region
• Crop Notification and scroll area
• Embedded screenshots in cucumber reports
• Driver independent. Can work with appium or calabash etc
• Easily integrate in CI by setting NAKAL_MODE environment
variable
• Use ImageMagick fuzz for better comparison
21. Best Practices
• Use mocking to make your components reliable
• Use directories to organize your baseline. e.g:
nakal_execute(“login_flow/home_screen”)
• Don’t use if UI is under very active development
• Use only when there is genuine need
Recently I started working in a mobile project where we are developing an enterprise application for one of the biggest airline and found some challenges with automated testing.