Friday, October 3, 2008
Watir syntax
#Enable Instant Forward to Voice Mail
require ‘watir’
include Watir
ie = IE.new
ie.goto( ‘http://www.vonage.com/’ )
ie.text_field( :name, ‘username’ ).set( ‘username’ )
ie.text_field( :name, ‘password’ ).set( ‘password’ )
ie.button( :name, ’submit’ ).click
ie.link(:text,”Features”).click
ie.button( :name, ‘callForwardingButton’ ).click
ie.select_list( :name, ‘callForwardingSeconds’ ).select( ‘Instantly’ )
ie.text_field( :name, ’singleAddress’ ).set( ‘15035551234′ )
ie.button(:value,’Enable’).click
ie.link(:text,”Log Out”).click
ie.close
Thursday, October 2, 2008
Ruby Script to exe conversion
Description:
RubyScript2Exe transforms your Ruby application into a standalone, compressed Windows, Linux or Mac OS X (Darwin) executable. You can look at it as a “compiler”. Not in the sense of a source-code-to-byte-code compiler, but as a “collector”, for it collects all necessary files to run your application on an other machine: the Ruby application, the Ruby interpreter and the Ruby runtime library (stripped down for your application). Anyway, the result is the same: a standalone executable (application.exe)
Installation:
1. Install ruby — Latest version Ruby1.8.6 available from http://www.ruby-lang.org/en/downloads/
2. then goto command prompt and run the command
c:\ruby\gem install rubyscript2exe
3. In case u don’t have net connection then download that gem file and use the following command.
http://rubyforge.vm.bytemark.co.uk/gems/ this link will help to download rubyscripttoexe.gem file
then paste that gem file to c:\ruby\bin\PASTEHERE
Goto command prompt c:\ruby\bin\gem install rubyscript2exe
Now your machine is ready convert one ruby file to exe.
4. If u want to convert c:\test\example.rb file to exe.
Then goto command prompt just run the following command
c:\test\rubyscript2exe example.rb -w
5. Now u look ur folder c:\test. The new exe file placed on that window.
Just double click that exe. Now you are ready to publish that exe to all.
Feature:
1. Run the EXE file –> There is no need to install ruby.
2.No nees to install gems also.
3. Watir - ( Web automation testing in Ruby ) This gem plays as a major role in Rubyscript2exe.
Regards,
P.Raveendran
VM WAre Server console
Installation of VMware:
1.Download VMware server console.
For free download — http://reister.vmware.com/content/download.html
2. Create short cut to desktop.
Working with VMware:
1. Start — programs — VMware — VMware server –Click VMware server console.
2. Select Local host and click ok.
3. File — New — Virtual Machine
4. Click next.
5. Select the appropriate configuration. Here select — typical and click next button.
6. Select a guest OS. Select anyone from list.
7. Ex. Select Micro Soft windows with the version of windows 2000 professional.
8. Name the virtual machine
9. Select your network type and click next.
10. Specify disk capacity. How much capacity need if you want to work with that OS. Disk size in GB.
11. Click finish button. Now you are ready to work with new OS.
12. I have two OS for separately to work with IE6 and IE7. Now I am going to working with both OS at a time.
13. Click start this virtual machine or play (green)
14. New Os loading…….
15. Just press ctrl+alt key. The you are directly work with new OS. If u want to back base OS then simply press again ctrl+alt.
16 . VMware working speed is depends upon your system configuration.
Just install and work with VMware . More interesting options are there.
Regards,
P.Raveendran
Drive with watir
Watir Features:
Please go through my previous post named as Watir.Some basic points are there.
Now I come to the point, How watir helps to Tester for write automation scripts in Ruby language.
Ya it’s simple. Watir helps ..
1. Automatically write in text box –> text box name or value or id Important(WET is used to identify the filed names.)
2. Automatically click buttons.
3. select list boxes,and so on…
4. How can i know about field names, values, and id.
WET - Web Environment Testing.
It is also a gem file just install it
c:\gem install wet
and run this program. Change URL www.google.com to Your Own page(Need View page)
Program:
require ‘WET’
include WET
ie= Browser.new
ie.goto”www.google.com”
ie.show_objects
ie.close
If u want to learn more about WET then follow this link
http://wet.qantom.org/download.html
5. Watir can have easily understandable codings. Not need to any previous programming skills. Fresher also easily pick up this scripting language.
My position in Watir:
I have done some scripts in Watir.
1. RFSearch Engine :
* If you want to search some thing in Net. But u dont have time to spent click and view all the things. You want only all the links with their URL.
* If you want to know about status of your site in google search engine. It will shows which page your site is placed in google search?
* Its depending upon Google search engine. it will works IE,Firefox(firewatir). Now i am working with Safariwatir.
2. Automatic Yahoo mail checking and Composing:
* It ask Your uaer name and password and as well as how many mails u want to see in your inbox after(Ask after visit your home page)
* If you want to read 10 mails then it will goes to automatically open that mails. Here I am using last come first serve method.So you read the latest mail in very first.
* Mail composing –> It ask To, Subject, Body contents…. and click automatically send button.
* Attachment also working with compose a mail.
I think this post is very useful to all new comers working with watir.
For more details : http://wiki.rubyonrails.org/rails/pages/HowToTestRailsWithWatir
Regards,
P.Raveendran
Watir Cheat sheet
Watir Cheat Sheet
Getting Started with Watir
| require ‘watir’ | Load the Watir library |
| ie = Watir::IE.start (’http://localhost:8080′) | Start IE using the local timeclock server. |
| ie.close | Close IE. |
| ie = Watir::IE.attach(:title, ‘title‘) | Attach to an existing IE window, so you can drive it with Watir. |
Manipulating Controls with Watir
| ie.text_field(:name, ‘name‘).set(’value‘) | Set the text field specified name specified value. |
| ie.button(:value, ‘value‘).click | Click the button with the specified value (label) |
| ie.button(:name, ‘name‘).click | Click the button with the specified name. |
| ie.checkbox(:name, ‘name‘).set | Check the check box named “name”. (Uncheck: clear) |
| ie.object(:attribute, ‘name‘).flash | Cause the specified control to flash. |
A Special Testing Function For Timeclock
|
require ‘toolkit/testhook’ ensure_no_user_data ‘name‘
| Delete any database records for the named user. |
Accessing Page Contents with Watir
| ie.contains_text(’text‘) | Return true if the current page has the specified text somewhere on the page. Otherwise, false. |
| ie.title | Return the title of the current page. |
| ie.html | Return all the HTML in the body of the page |
| ie.table(:id, ‘recent_records).to_a | Return an array containing the text in the table’s rows and columns. |
| ie.table(:id, ‘recent_records’)[2][1].text | Return the text from the first column of the second row of the table id’d ‘recent_records. |
Assertions
| assert_equal(expected, test_method) | Test whether the expected value matches the actual value returned by the test method |
| assert_match(regexp, test_method) | Test whether the regular expression matches the actual value returned by the test method. |
| assert(expression) | Test whether the expression is true. |