Saturday, 7 September 2013

(completed)Calabash IOS & Android online QA - Free session 21 & 28 Sep 2013

Hi All,

I am planning to conduct 2 live sessions to help my youtube audience get up to speed with calabash IOS & Android

If you are interested please add me (automationtutorial@gmail.com) on google plus


Youtube Channel Link - http://www.youtube.com/tejasv2 

Overview of sessions

(CONFIRMED)
21 Sep 2013 - Calabash IOS session ( 1- 1.5 hours)
Timings :  10 AM UK time (  2-30 PM Indian Time)

Contents: 
How to write step definitions using calabash
How to run queries
30 mins QA session 



(Tentative)
28 Sep 2013 - Calabash Android session  ( 1- 1.5 hours)
 Timings :  10 AM UK time (  2-30 PM Indian Time)

Contents: 
How to write step definitions using calabash
How to run queries
30 mins QA session


This will be an online session on Google hangout 


Thanks,
Tej 

Friday, 30 August 2013

Calabash IOS ruby installation (rvm) error and solution

echo progress-bar >> ~/.curlrc
execute command to install rvm with latest ruby:
\curl -L https://get.rvm.io | bash -s stable --ruby

Add below line into ~/.bash_profile
#RVM
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

Check calabash installation
 calabash-ios console
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem json (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
from /usr/bin/calabash-ios:18

install this command and you may see below error
sudo gem install json

unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/json/ext/generator.bundle,

sudo gem update --system
sudo gem install rdoc



Monday, 5 August 2013

Reading plist file using ruby : useful for calabash IOS Automation

#!/usr/bin/ruby -w
# encoding: utf-8

require 'plist'


def read_plist(plist_file)
  result=Plist::parse_xml(plist_file)
  i=0
  result.each { |k, v|
    i=i+1
    puts k
    puts v
    puts
  }
end

read_plist("features/dump/test.plist")

 Sample plist file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Language</key>
    <string>Svenska</string>
    <key>Version</key>
    <integer>4</integer>
  </dict>
</plist>




very useful while readings strings for localisation (calabash)

Saturday, 18 May 2013

Get rid of facetime, misson control from mac on every start in 3 steps

Step 1) cd /Library/Preferences
Step 2) sudo vi com.apple.dockfixup.plist
Step 3) Locate unwanted startup items and remove them , save the file and exit it and restart ur machine

Happy 'mac'ing
              <dict>
                        <key>after</key>
                        <string>begin</string>
                        <key>path</key>
                        <string>/Applications/Mission Control.app</string>
                        <key>tile-data</key>
                        <dict>
                                <key>file-type</key>
                                <integer>169</integer>
                        </dict>
                </dict>



                <dict>
                        <key>after</key>
                        <string>/Applications/Mission Control.app</string>
                        <key>path</key>
                        <string>/Applications/App Store.app</string>
                </dict>


                <dict>
                        <key>after</key>
                        <string>end</string>
                        <key>group</key>
                        <integer>80</integer>
                        <key>path</key>
                        <string>/Applications/Server.app</string>
                        <key>server</key>
                        <true/>
                </dict>

                <dict>
                        <key>after</key>
                        <string>/Applications/iChat.app</string>
                        <key>path</key>
                        <string>/Applications/FaceTime.app</string>
                </dict>



How to make personal website in 5$ / 5£ / 500 Rupees & 10 minutes!!

I started making a website for one of my relative and had to refresh my memory on how to get it up and running.

Here is how simple way to do it

Ingredients needed :

1) Domain name
2) web hosting server
3) Some html page.

How to get them 

1) I registered my domain at http://www.bigrock.in/, You can get a domain name at other popular sites like godaddy.com / net4.in

2) For web host server, I chose www.50webs.com/ which is my favorite free web hosting server for almost 5 years now.
Other options are using wordpress or blogger or some paid servers  like  hostgator

3) HTML code
open note pad , copy below code and save it as "index.html"
 <!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>  


Steps to do at Bigrock website


  1. Login to ur domain provider (say you have purchased domain name hello.com)
  2. click on your domain and choose website manager or similar options 
  3. update nameserver to point to your webhost in this case its dns1.50webs.com and dns2.50webs.com   check pic4
  4.  Once you have set nameservers wait for an hour or so and check domain provider website again Check picture fig5 below, It indicates some warnings ignore them (these warnings are an indication that nameservers are recognized)
  5. Mean proceed to next section where we upload files to web host
 

Pic4: Set name servers


Fig5: Ignore these errors

 Steps for uploading files to webhost (50webs.com in this case)

  1. Create login and log into 50webs.com
  2. Go to domain manager -> my domains -> hosted domain -> host domain 
  3. Create a domain name exactly same as your website name (purchased with bigrock ex: hello.com). Having same name will help 50webs resolve DNS to your website for all incoming traffic that comes to your domain purchased at bigrock.
  4. Copy the index.html file we saved previously in to file manager for the newly created domain in step3
  5. Wait for 1-2 hours for DNS and NS to recognize ur website
  6. In my case it took1 hour but it might take upto 24 hours for DNS to be working properly 
Hope you website must be up & running soon
Drop a link to ur site when you have created using my blog
It makes me feel proud :)

Thursday, 9 May 2013

Reading Excel file using ruby


 This is an example to read excel file in ruby (this can be used for reading excel workbook as well) using RubyXL gem

Step 1) Create an excel workbook like below



 Step 2) Create a ruby file including gems
require 'rubygems'
require 'rubyXL'

Copy path to excel file and replace it in place of work book
    workbook = RubyXL::Parser.parse("/Users/username/Downloads/simple_spreadsheet.xlsm")



This first sheet of excel workbook can be read into hash table using below command
    hash_arr=workbook[0].get_table(["Login", "email", "password"])

Multiple tables can be present in same file and they will read based on the format given in the above command (this helps in organizing many data tables in single sheet of excel file)



 Step 3: If needed it can be used in cucumber file as below


Source code :


require 'rubygems'
require 'rubyXL'
workbook = RubyXL::Parser.parse("simple_spreadsheet.xlsm")
hash_arr=workbook[0].get_table(["Login", "email", "password"])
all_tables=hash_arr[:table]
puts all_tables


For more details refer to - https://github.com/gilt/rubyXL project

Output looks like below




















calabash-ios: reusing step definitions using macros

This post is intended to explain how to reuse step definitions in calabash

Lets see with an example with a feature file

  Scenario Outline: I am able to test macro
    Given I want to test macro
    Then I have macro "hello"
  Examples:
    | filename  |
    | hello     |


Step definitions file


Call the second step definition here 
Given(/^I want to test macro$/) do
  var="test string"
  macro 'I have macro "'+var+'"'
end





This step can be used as macro in other step definitions

Then(/^I have macro "(.*?)"$/) do |arg1|
  puts arg1
end