Test Automation using Ruby, Watir, Rspec and AutoIT         for GAMESCALE products testing.   Presented by Sveatoslav Circ...
Test Automation using Ruby, Watir, Rspec                                and AutoIT for GAMESCALE productsCoverage:*Introdu...
Test Automation using Ruby, Watir, Rspec                                                   and AutoIT for GAMESCALE produc...
Test Automation using Ruby, Watir, Rspec                                      and AutoIT for GAMESCALE productsThe Ruby La...
Test Automation using Ruby, Watir, Rspec                                    and AutoIT for GAMESCALE products       What i...
Test Automation using Ruby, Watir, Rspec                              and AutoIT for GAMESCALE products      Why use Watir...
Test Automation using Ruby, Watir, Rspec                                                     and AutoIT for GAMESCALE prod...
Test Automation using Ruby, Watir, Rspec                                    and AutoIT for GAMESCALE products     Features...
Test Automation using Ruby, Watir, Rspec                                                   and AutoIT for GAMESCALE produc...
Test Automation using Ruby, Watir, Rspec                                                  and AutoIT for GAMESCALE product...
Test Automation using Ruby, Watir, Rspec                                                          and AutoIT for GAMESCALE...
Test Automation using Ruby, Watir, Rspec                                              and AutoIT for GAMESCALE products   ...
Test Automation using Ruby, Watir, Rspec                              and AutoIT for GAMESCALE productsBest Practices for ...
Test Automation using Ruby, Watir, Rspec                                                       and AutoIT for GAMESCALE pr...
Test Automation using Ruby, Watir, Rspec                                                       and AutoIT for GAMESCALE pr...
Test Automation using Ruby, Watir, Rspec                                                         and AutoIT for GAMESCALE ...
Test Automation using Ruby, Watir, Rspec                                                       and AutoIT for GAMESCALE pr...
Test Automation using Ruby, Watir, Rspec                                           and AutoIT for GAMESCALE products      ...
Basic Script structure and validation points.                 FR006-Frontend-FAQ-Elements-Conan-Club-VIP.rb
Test Automation using Ruby, Watir, Rspec           List of Frontend scripts in SVN                       and AutoIT for GA...
Test Automation using Ruby, Watir, Rspec                              List of Backend (BOUI) scripts in SVN               ...
Test Automation using Ruby, Watir, Rspec                                                             and AutoIT for GAMESC...
Test Automation using Ruby, Watir, Rspec                                                              and AutoIT for GAMES...
Test Automation using Ruby, Watir, Rspec             and AutoIT for GAMESCALE productsQuestions ?…
Upcoming SlideShare
Loading in …5
×

Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products testing.

3,817 views

Published on

Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products testing.
Presented by Sveatoslav Circel, Senior QA @Gametech LLC.

Published in: Technology
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,817
On SlideShare
0
From Embeds
0
Number of Embeds
18
Actions
Shares
0
Downloads
0
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products testing.

  1. 1. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products testing. Presented by Sveatoslav Circel, Senior QA @Gametech LLC. mailto:sveatoslav.circel@gametech.md
  2. 2. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE productsCoverage:*Introduction and advantages.*Getting started with Ruby and Watir.*Basic Watir elements and functions.*Script structure and validation points.*SVN Repository for automation scripts.*Running the tests (BOUI + Frontend).*Running the tests in batch.*Analyzing the logs/results.*Debugging with IRB.
  3. 3. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Advantages of Test AutomationReliable: Tests perform precisely the same operations each time they are run, thereby eliminating human errorRepeatable: You can test how the software reacts under repeated execution of the same operations.Programmable: You can program sophisticated tests that bring out hidden information from the application.Comprehensive: You can build a suite of tests that covers every feature in your application.Reusable: You can reuse tests on different versions of an application, even if the user interface changes.Better Quality Software: Because you can run more tests in less time with fewer resourcesFast: Automated Tools run tests significantly faster than human users.Cost Reduction: As the number of resources for regression test are reduced.
  4. 4. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE productsThe Ruby Language  Dynamic;  Easy to understand syntax;  Easy to use interpreter;  Object oriented;  Cross-platform;  Powerful class libraries;  Massive online support communities base; More info on ruby: http://www.youtube.com/watch?v=fYIEV_6xhck
  5. 5. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products What is Watir? A free, open-source functional testing tool for web applications. It is a Ruby library which drives almost any browser the same way people do, clicks links, fills in forms, and presses buttons. Watir also checks results, such as whether expected text appears on the page or not. Because it’s build on Ruby, you have the power to connect to databases, read data files, save screenshots, manipulate the file system, export to CSV and XML, structure your code into reusable libraries.
  6. 6. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Why use Watir? Free Powerful Simple (easy to use and learn) Excellent Support It uses Ruby, a full-featured object oriented scripting language Broad usage in high level client base.
  7. 7. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products What the Users say…− “…WATIR is by far the most complete web testing framework out here--that doesnt cost an arm and a leg. And this forum is the most active and well supported that I have seen. You can post a question and is just a short period of time get someone (most of the time the architects of the framework!) who will steer you in the right direct, give you a work around to get over any roadblocks, or add it to the framework if it doesnt currently exist. That is the reason I switched and tell everyone interest (and those not) that Ruby is the way to go! Save your money, get WATIR!” − “Ruby is an awesome language and Watir is just too cool. It does things that other companies (ie. IBM/Rational, Mercury, Segue, etc) charge thousands and thousands of dollars a seat for. Anyway, now that Im gettin the hang of Ruby and Watir, Im starting to automate everything I do on the web. Even the simple things like logging in to web sites, searches, you name it.” (source: www.watir.com)
  8. 8. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Features: Ruby Watir Can handle multiple browser windows with attach methods. Supports JavaScript events. Supports frames and nested frames. Supports visible and invisible running of test cases. Automatically waits for pages to be loaded. Supports hidden fields and saving images in a page. Capturing of the screens.
  9. 9. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products How do we get started?Install Ruby: Use the www.rubyinstaller.org/downloads/ link, download and install latest version.Install rubygems update(http://rubygems.org/) with the following ruby command prompt (Start -> Programs -> Ruby 1.9.3 -> Start Command Prompt with Ruby): gem update --systemDownload DevKit, that makes it easy to build and use native C/C++ extensions. Wed need that for Opera and Chrome support. Follow the install instructions in: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit Install ChromeDriver. For Google Chrome, additionally, wed need to install the library. Go to http://code.google.com/p/chromedriver/downloads/list and download latest version. Unzip the file and put it in any folder that is in your PATH. (For example C:Ruby1.9.3Bin)Install Watir-Webdriver gem in ruby command prompt (Start -> Programs -> Ruby 1.9.3 -> Start Command Prompt with Ruby): “gem install watir- webdriver”Read the Users Guide, documentation, examples and tests for reference.
  10. 10. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Some Helpful Tools…Editors:• Notepad++ (A good light-weight editor supporting Ruby code orthography and stylistics)Tips for finding/accessing HTML elements:• IE Developer Tool bar (Lets you explore the HTML elements behind the visible elements on a web page by clicking on the elements• FireBug (Excellent FireFox extension for identifying HTML elements while writing scripts.)• WATIR::SupportsSubElements (Watir API for accessing html elements)
  11. 11. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Navigating the Browser# Always Loading the Rubygems and Watir/Webdriver libraries at the top of each scriptrequire rubygemsrequire watir-webdriver#Start a browser and navigate to a given URLbrowser = Watir::Browser.start(http://conancasino.com)#or.. open a separated instance of any of supported web-browsers:browser = Watir::Browser.new :firefoxbrowser = Watir::Browser.new :iebrowser = Watir::Browser.new :chrome (need to be pre-configured)browser = Watir::Browser.new :opera (need to be pre-configured)browser = Watir::Browser.new :safari (only for Mac OS X)(note: in my scripts I set a variable called b instead of browser; thus in most of the scripts it would look like: b = Watir::Browser.new :chrome)#Navigate to a different URLbrowser.goto("http://www.conancasino.com/")#Close IE.browser.close
  12. 12. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Finding <HTML> ElementsTextBox browser.text_field(:name, “name”).set “Value”Button browser.button(:text, /text/).clickDropDownList browser.select_list(:id, “id”).set “Value”CheckBox browser.checkbox(:class, “class_id”).clickRadioButton browser.radio(:class, “class_id”).clickHyperLink browser.link(:href, “URL”).clickForm browser.form(:name, “name”).set “Value”Frame browser.frame(:id, “frame1”).useAnd many, many more (div, label, image, etc…)…
  13. 13. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE productsBest Practices for Watir Locators – The Locator Tree of Life
  14. 14. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Flash Automation require win32ole autoit = WIN32OLE.new("AutoItX3.Control") autoit.WinActivate("Chrome","Conan Casino") autoit.MouseClick("left",950,500,1)I have recorded a small automated test run session for your convenience:http://dl.dropbox.com/u/485410/Presentation/Flash_Automation_with_Ruby_Watir_and_Autoit.mp4
  15. 15. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Running the scriptsScripts are being executed using Ruby command promt. Openruby command prompt (Start -> Programs -> Ruby 1.9.3 ->Start Command Prompt with Ruby); CD to directory withscripts; Run using the following command:ruby name_of_the_script.rbI have recorded a small automated test run session for your convenience:http://dl.dropbox.com/u/485410/Presentation/Running_a_script_and_analyzing_results.mp4
  16. 16. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Running the scripts in batchIn order to be able to run the scripts in batch, we created a simple*.BAT file, in which included the set of all available scripts,including both error and positive output redirection to txt files:ruby FR001-Account-Creation-chrome.rb > FR001-Account-Creation-chrome.txt 2>&1…Open ruby command prompt (Start -> Programs -> Ruby 1.9.3 ->Start Command Prompt with Ruby); CD to directory with scripts;C:automationqa>Frontend.batI have recorded a small automated test run session for your convenience:http://dl.dropbox.com/u/485410/Presentation/Analyzing_the_batch_results.mp4
  17. 17. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Analyzing the resultsThe scripts are saving 3 type of results:1. Export scenario output as Passed/Failed in the test_results.csv, includingthe name of the test and time of execution.2. Save screenshots of the web pages in the same dirrectory where thescript is located.3. Print the output to the user within the windows ruby shell - cmd. (canalso be redirected as output to a different file using > file.txt for furtheranalysis)I have recorded a small automated test run session for your convenience:http://dl.dropbox.com/u/485410/Presentation/Analyzing_the_batch_results.mp4http://dl.dropbox.com/u/485410/Presentation/Running_a_script_and_analyzing_results.mp4
  18. 18. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Local SVN RepositoryThe scripts are located in our SVN which is being permanently updated and renewed by new commits of improved scripts. The read-write permissions are granted only to QA team (including myself, Nick, Dmitrii and Vitalii). Read permissions – accessible to anyone within the company.To access to SVN you have 2 ways 1. In browser go to link: http://192.168.10.10/svn/gs1/trunk/tests/automatization/qa2. Download the "TortoiseSVN" (http://tortoisesvn.net/downloads.html) and synchronize it with your local folder.Note: Do not run the scripts from SVN, copy to local.
  19. 19. Basic Script structure and validation points. FR006-Frontend-FAQ-Elements-Conan-Club-VIP.rb
  20. 20. Test Automation using Ruby, Watir, Rspec List of Frontend scripts in SVN and AutoIT for GAMESCALE products Up to date as per May 7th, 2012.FR001-Account-Creation-chrome.rbFR002-FAQ-Elements-Account_chrome.rbFR003-FAQ-Elements-Cashier_chrome.rbFR004-FAQ-Elements-All_chrome.rbFR005-FAQ-Elements-Common-Questions_chrome.rbFR006-FAQ-Elements-Conan-Club-VIP_chrome.rbFR007-FAQ-Elements-Deposit_chrome.rbFR008-FAQ-Elements-Legality-and-Security_chrome.rbFR009-FAQ-Elements-Responsible-Gaming_chrome.rbFR010-FAQ-Elements-Technical_chrome.rbFR011-FlashBanner-InstantPlay_chrome.rbFR012-FlashBanner-SafeDownload_chrome.rbFR013-Forgot-Password_chrome.rbFR014-Games-AngelSlot-Real-Mode_chrome.rbFR015-Games-AngelSlot-Practice_chrome.rbFR016-Help_Center-Classic_Slots-Rules-chrome.rbFR017-Help_Center-Other_Games-Rules_chrome.rbFR018-Help_Center-Table_Games-Rules-chrome.rbFR019-Help_Center-Video-Poker-Rules-chrome.rbFR020-Help_Center-Video-Slots-Rules-chrome.rbFR021-Help_Center-VIP-Games-Rules-chrome.rbFR022-Help_Center-All-Game-Rules-Level0.rbFR023-Mainpage-Footer_Menu(About-Affiliates).rbFR024-Banking_Payment-Options(Visa-Skrill-etc)_chrome.rbFR025-Mainpage_SPECIAL_BONUS_OFFER_chrome.rbFR026-Mainpage_PROMOTIONS-CALENDAR_chrome.rbFR027-Mainpage_FEATURED_GAME_chrome.rbFR028-Promotions-Page_chrome.rbFR029-Get_Started_chrome.rbFR030-MyAccount_Account_Statement_chrome.rbFR031-MyAccount_Conan_Club_VIP_chrome.rbFR032-MyAccount_Game_History_chrome.rbFR033-MyAccount_Personal_Details_chrome.rbFR034-MyAccount_Responsible_Gambling_chrome.rbFR035-Mainpage_Panel_Menu_chrome.rbFR036-Mainpage_Languages_chrome.rbFR037-Mainpage_Live-Chat_chrome.rb
  21. 21. Test Automation using Ruby, Watir, Rspec List of Backend (BOUI) scripts in SVN and AutoIT for GAMESCALE products Up to date as per May 7th, 2012.BO001-BOUI-Auto_Deposit_Bonuses-Add_New(not_done).rb BO041-BOUI-Role_Management-Update_Fields-Financial.rbBO002-BOUI-cancel_bet.rb BO042-BOUI-Role_Management-Update_Fields-Games_History.rbBO003-BOUI-Game_History_All_Games.rb BO043-BOUI-Role_Management-Update_Fields-Loyalty.rbBO004-BOUI-Game_History_Classic_Slots.rb BO044-BOUI-Role_Management-Update_Fields-Marketing.rbBO005-BOUI-Game_History_Featured_Games.rb BO045-BOUI-Role_Management-Update_Fields-Payment_Options.rbBO006-BOUI-Game_History_Other_Games.rb BO046-BOUI-Role_Management-Update_Fields-Payment-Fraud.rbBO007-BOUI-Game_History_Table_Games.rb BO047-BOUI-Role_Management-Update_Fields-Personal-Details.rbBO008-BOUI-Game_History_Video_Poker.rb BO048-BOUI-Role_Management-Update_Fields-Player_Page.rbBO009-BOUI-Game_History_Video_Slots.rb BO049-BOUI-Role_Management-Update_Fields-Players.rbBO010-BOUI-Game_History_VIP_Games.rb BO050-BOUI-Role_Management-Update_Fields-Reports.rbBO011-BOUI-Manual_Bonuses-Add_New(not_done).rb BO051-BOUI-Role_Management-Update_Fields-Self-exclusion.rbBO012-BOUI-Online_players.rb BO052-BOUI-Role_Management-Update_Fields-System.rbBO013-BOUI-Player_details_personalDetails-tabpanel_Elements.rb BO053-BOUI-Role_Management-Update_Fields-User_Limits.rbBO014-BOUI-Player_details_PlayerHeader_Elements.rb BO054-BOUI-Role_Management-Update_Fields-User_Log.rbBO015-BOUI-Player_lookup_Search_by_Country.rb BO055-BOUI-Role_Management-Update_Fields-Users.rbBO016-BOUI-Player_lookup_Search_by_Email.rbBO017-BOUI-Player_lookup_Search_by_Firstname.rbBO018-BOUI-Player_lookup_Search_by_IP.rbBO019-BOUI-Player_lookup_Search_by_Lastname.rbBO020-BOUI-Player_lookup_Search_by_LoggedIn_All.rbBO021-BOUI-Player_lookup_Search_by_LoggedIn_not.rbBO022-BOUI-Player_lookup_Search_by_LoggedIn_only.rbBO023-BOUI-Player_lookup_Search_by_Mobile.rbBO024-BOUI-Player_lookup_Search_by_Phone.rbBO025-BOUI-Player_lookup_Search_by_RefID_negative_values.rbBO026-BOUI-Player_lookup_Search_by_RefID_positive.rbBO027-BOUI-Player_lookup_Search_by_UID.rbBO028-BOUI-Player_lookup_Search_by_Username.rbBO029-BOUI-Player_lookup_Search_by_Zip.rbBO030-BOUI-Reports-Accounting_Report-chrome.rbBO031-BOUI-Reports-Deposit-chrome.rbBO032-BOUI-Reports-Fraud_Report.rbBO033-BOUI-Reports-Management_Report(not_done).rbBO034-BOUI-Reports-Permission_access_report-chrome.rbBO035-BOUI-Reports-Player_by_game_performance_report-chrome.rbBO036-BOUI-Reports-Player_general_performances_report-chrome.rbBO037-BOUI-Reports-Player_Report.rbBO038-BOUI-Role_Management-Update_Fields-Affiliate_Info.rbBO039-BOUI-Role_Management-Update_Fields-Bets.rbBO040-BOUI-Role_Management-Update_Fields-Bonuses.rb
  22. 22. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Debugging with IRB• IRB = Interactive Ruby Shell; Command line-like interface that allows immediate running of Ruby script. Great for debugging one line at a time, rather then having to run through an entire script. Great for testing single lines
  23. 23. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products Plans for the future Practice test-driven development. Defects can be described using a test script that reproduces the defect. (attaching the script to Jira) Automation training the manual testers Creating a VM with ruby & watir pre-setup and ready to go. VirtualBox implementation and support of all OSes and browsers for test automation (Win, *nix and Mac OS X systems) Continuous integration with JENKINS:http://watirmelon.com/2011/08/29/running-your-watir-webdriver-tests-in-the-cloud-for-free/http://blog.houseofsoft.org/2011/04/05/automate-your-feature-tests/4/http://martinfowler.com/articles/continuousIntegration.html
  24. 24. Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE productsQuestions ?…

×