Showing posts with label rubymotion. Show all posts
Showing posts with label rubymotion. Show all posts

08 June 2014

Using Frank with Rubymotion

Writing acceptance tests for iOS application in Rubymotion

Steps involved

1) Add the motion-frank gem to the Gemfile
2) Run the initializer rake frank:init_features
3) Now you have the features directory.
4) Write a sample test

eg: 
Feature: Navigating around the app / smoke test
  As a user
  I want to be able to get to all parts of the app
  So I can use it and not get confused or lost
Background:
  Given I launch the app
  Given I am on the search Screen with empty search
Scenario: Search
  Given I am on the search screen
  Then I should see a navigation bar with label text "Search"
  When I fill in a search term
  Then I should see a navigation bar with label text "Results"
5) Save this as a xyz.feature file
6) Run rake frank to see this test fail
7) Add the step definition file in the features/step_definitions named something like xyz_steps.rb
8) Add step methods describing the steps and what should happen on the simulator to match the test. 

eg.
Given(/^I am on the search Screen with empty search$/) do
  wait_for_element_to_exist_and_then_touch_it("textField placeholder:'Search by name'")
end

Given(/^I am on the search screen$/) do
  check_element_exists("textField placeholder:'Search by name'")
end 

and go on ....

Go through the sameple steps and implementation in the frank-cucumber library to get hold of more methods to test the UI.

Also you can use rake frank:symbiote to get the list of UI elements accessible for testing in a simulator.

Run "rake frank:symbiote" in the Rubymotion directory and once the simulator is up with the application open the browser and navigate to "localhost:37265" 


Quick Tips : 

1) For ruby code which like occurs in multiple step file , write ruby files in the support folder such as
def check_search_bar
  check_element_exists("textField placeholder:'Search by name'")
end
Now you can use this check_search_bar method in any step definition file & reduce the amount of code you write to get your code working.


Happy Testing with cucumber !! Its fun. 











29 March 2013

TCS RSS Feed Reader 123


TCS RSS Feed
This is an iOS application build using

Running on Simulator/Device

You will need Rubymotion installed on your Mac.
  1. Clone repo git clone git@github.com:upadhyay-ashish/TCSRssReader.git
  2. Bundle gems bundle install
  3. Setup cocoapods pod setup
  4. Setup Developer license reference in the Rakefile
  5. To run on simulator rake else to run on a Device rake device
  6. To create a distribution IPA rake archive:distribution