Quality to me is

"Synergistic phenomena experienced by the user(s) when the product or a service satisfies the requirements, achieves business goals, exceeds expectations, is incredibly usable with real-time servicing & updates, optimal performance and cost effective"

Friday, March 22, 2013

Calabash Cucumber for iOS

Calabash Cucumber for iOS - Required Tools
Calabash library and framework
Cucumber tool - To execute the feature
Gherkin – to write steps [Behavior driven, domain specific language]
Jenkins/maven for Reports
Ruby gems – All of the above require ruby, as they are written in ruby

Calabash iOS
Automation and test library for iOS
Behavior Driven Development for testing
Consists of 2 parts
Client library : written in Ruby
Calabash.framework: server framework written in objective C ( have to be linked to our test build)

Calabash Architecture
The server framework will start an HTTP server inside our app that listens for requests from the client library (Courtesy: Lesspainful.com)



Accessibility Labels
One of the ways calabash interacts with the UI elements in your app via accessibility labels.
That’s how it knows which button to tap when a command like Then I touch "reply“ is issued
Enable this from Settings->General->Accessibility->Accessibility Inspector (ON)

Writing a test
You’ll need two files
xxx.feature (steps are written using Gherkin)
Xxx.rb (steps are implemented using ruby)
There are a lot of predefined steps that come when you install calabash cucumber iOS
Custom steps can be written using ruby

Sample Feature File
Feature: Send Email Logs from Workplace
   As an iOS tester
   I want to  go to My device tab
   so I can send email logs
Scenario: Send Email logs
   Given I am on my device
   Then I touch “Email Logs”
Sample Step definition
Given /^I am on my device$/ do
  if view_with_mark_exists(“Email Logs”)
  macro ‘I should see a “Email Logs” button’
  end
end

Running on simulator
Bind your app with calabash.framework and create a testbuild and launch it in simulator
The following will be there on Xcode console
Creating the server:
Started LPHTTP server on port 37265
Bonjour Service Published: domain(local.) type(_http._tcp.) name(Calabash Server)
 

Command to run on simulator
$DEVICE=iphone OS=ios5 NO_LAUNCH=1 cucumber features/send_email.feature
Run Group of tests
Tag the scenarios with @
@negative_test
Scenario: Send email button pushed down
DEVICE=iphone OS=ios5 NO_LAUNCH=1 cucumber --tags @negative_test
Exclude some tests by ~
DEVICE=iphone OS=ios5 NO_LAUNCH=1 cucumber --tags ~@negative_test

Running it on device
The device and the machines that runs xcode has to be on the same wifi.
DEVICE=iphone OS=ios5 NO_LAUNCH=1 cucumber features/send_email.feature DEVICE_ENDPOINT=http://your.device.ip.address:37265

Calabash-ios Console
You can get into the interactive ruby console
$calabash-ios console
Another way to find out UI elements is thro console.
$query "tableViewCell index:0“
This can be used to write custom step definitions.

Record and Playback from Calabash-ios Console 
Record and playback
$record_begin
$Record_end “xxx”
Creates a .base64 file with the above name
$playback “xxx”

Download links
https://github.com/calabash/calabash-ios

Saturday, March 16, 2013

iOS Automation

I finally decided to write on iOS automation after evaluating couple of tools.
The tools that I tried are
1. Fone Monkey (I tried it when it was fone monkey)
2. Test Studio
3. UIAutomation (from Xcode Instruments)
4. Calabash Cucumber framework.

Fone Monkey, was easy to setup and the device had to be on the same wifi as the desktop/laptop, where the fonemonkey is integrated with the build.
As it works via the JSON string commands. the difficulty was the same script passed and failed based on the speed of connectivity.

Test Studio, the scripts are easy to comprehend. Easy for demo purposes. But to edit and insert your own code will be difficult. also, not sure if the latest version supports the hybrid app. coz html links were not working. Also, the scripts once written had to be exported. And the scripts have to be recorded for each device stack.

UIAutomation from Xcode Instruments. It is a viable tool where the scripts can be written using javascript. You can automate both native and hybrid apps. It is an amazing tool, where the UIAutomation ref pdf from apple is up to the mark. But you may need to to maintain the code.

Calabash Cucumber, has a long list of setup instructions which will guide you to install ruby version manager (rvm) and ruby gems, calabash ios, cucumber etc. But they are to the point, including the possible errors that one might encounter. Once you set that up, there are predefined functions which are called predefined steps. They are all included in the resources file. All you need to do is start writing code in natural language in a file that has an extension as .feature. Viola, the script runs flawlessly! You have a specific requirement, you can write your own custom steps. Also, record and playback is easier, not only that, you can save it as a .base64 file and can call from your script using the playback function!. Since it is in natural language, you dont need an automation specialist to write your scripts.
The only drawback is, if you have a backend platform (portal) to which the app talks, those steps cannot be automated using this, except for the workflows that you can execute with curl commands, or the ones, where you can make a function call. But for an app only application, that does not require end to end (from portal to app), this is a blessing. Support wise there are a lot of blogs threads, where you can get prompt answers.

Thursday, March 7, 2013

Jailbreak iOS 6.1.2 with Evasi0n

Today I did jail break an iOS 6.1.2 device with evasi0n (http://evasi0n.com/).
I should admit, that it was a pleasant experience in a long time!
I have been continuously jail-breaking every release of iOS from 4.0 for testing purposes.
Things were easier with just Jailbreakme.com. But with the later versions of iOS, the number of steps were up with number of tools to be downloaded, like, setting your device in recovery mode, redsn0w, tiny umbrella and the number of device reboots etc.
Among these green poison absinthe was easier to explain to others.
Also, there were problems like the jailbreak not working on device reboot, device freeze etc.
But today I tried with the Evasi0n and I pretty much did not do anything apart from downloading Evasion and clicking on Jailbreak.
Abracadabra!! the device is jailbroken and cydia was installed.
However - there is one thing that has to be taken care of: Disable the password for backup and recovery of the iPhone