test automation
TRANSCRIPT
Outline
Introduction– Testing– Comparisons– Automation Testing Tool– Implement Steps
Environments– Ruby Installer– Devkit– Rails and Calabash-Android
Implements
Testing
Unit Testing– A software testing method by which individual units of source
code
Integration Testing– A phase in software testing in which individual software modules
are combined and tested as a group.
Regression Testing– A type of software testing that seeks to uncover new software
bugs, or regressions
Manual and Automatic
Manual AutomaticHigh Effort and Cost
requirements Low Effort and Cost requirements
Time consuming Quick, allows test engineers to focus on functional areas
Tests are not reusable Complete reusability based on type of implementation
Mostly used for integration testsCan be used for any tests
including load, sanity, system, etc
Risk of human errors Script validates all areas once tested
Cucumber
A framework for writing software specifications
A tool for executing those specifications– Specifications are written in a readable language that is close to
natural language.
– Scenarios – user behavior driven tests
– Steps – combine mobile operation and logic
Calabash
A tool– Predefined and custom steps– Reuse of tests across platform possible– For BDD-style acceptance testing
Run on physical devices or simulators Support for webview Ruby based Cross-platform mobile testing tool– Cucumber: Android or IOS testing
Implement Steps
Describe behavior in plain text
Write a step definition in Ruby
Run and watch it fail Run and watch it success
Write code to make the step pass
Describe behavior in plain text
Feature– Descriptions
Scenario– Descriptions– Preconditions– Steps
Given When And But Then
Ruby Installer
Download RubyInstaller
Install– Check the option named “Add Ruby executables to your PATH”
– Test it Using “ruby –v” on cmd window
– Observer Show “ruby 2.0.0p353 (2013-11-22) [x64-mingw32]”is success.
DevKit
Download DevKit in a folder which you want to save– For Instance: D:\DevKit
Navigate the folder on cmd window– Using “ruby de.rb init”
Check the file named config.yml is existent
Using “ruby dk.rb install”on cmd window
Rails and Calabash-Android
Using “gem update --system” and “gem install rails --no-ri --no-rdoc”on cmd window
Install Rails– Using “gem install rails --no-ri --no-rdoc”
Test it– Using “rails –v” on cmd window
It is successful to show “Rails 4.0.2”
Using “gem install calabash-android” on cmd window
Prepare Test Cases
Create a Cucumber skeleton in your Android project– Using “calabash-android gen”
on cmd window
Create a *.feature file– That is a test case file including
features, function descriptions or scenarios.
Given, When and Then
Given– your preconditions
When– describe the key action
Then– observe outcomes or an assertion
And, But– Using it if you have several givens, whens or thens.
Basic API
Find out a view - Query(uiquery, *args)– You can find views and other application objects, and make
assertions about them or extract data from them, and query returns an array of its results. For instance:
Basic API
Touch - touch(uiquery, options={})– Touches a view found by performing the query uiquery.
For instance:
Basic API
Entering text - enter_text(uiquery, text, options={})– Taps the first element returned by uiquery, then enters text into
the view. For instance:
Basic API
Tap - tap_when_element_exists(uiquery, options={})– Waits for an element and taps it when it appears on screen. It
raises an exception if the element doesn't appear within the timeout. For instance:
Basic API
Scroll - scroll_down and scroll_up– Scrolls the first instance of 'android.widget.ScrollView' either
downwards or upwards. For instance: