Why Every Tester Should Learn Ruby

Raimonds Simanovskis
Raimonds SimanovskiseazyBI founder and core developer at eazyBI
Why Every Tester
Should Learn Ruby
Agile
                                     Open-
Technology                           source
                                     github.com/rsim
    Ruby
 JavaScript
              Raimonds Simanovskis



                       @rsim

                         .com
Who are testers?




    Robots?
Who are testers?




... or automation ninjas
   who create robots?
Many Tools
Many Scripting
 Languages
HP (former Mercury)
   VBScript dialect
IBM Rational Robot
SQABasic (VB dialect)
  declare sub CheckSave     'allocate name defined below.
  '$Include "sqautil.sbh"    'used for datapool scripts.
  '$Include "global.sbh"     'used by all scripts.
  Sub Main
  !   Dim Result As Integer
  !   'Explicitly declare variable:
  !   !   dim strOpSys As String, strFileName As String
  !   !   dim strScriptUsed As String, strReturn As Integer
  !   !   const SCRIPTUSED As String = "Using Script 5/8/99"

  !   'Assuming that the application is opened by the calling module:
  !   'Press Alt-File, Save As to open dialog box:
  !   !   InputKeys %"FA"
  !   !   '    MenuSelect "File->Save As..." not used

  !   'Analyze pop-up window to detect and handle unexpected dialog:
  !   !   'Instead of Window SetContext, "Caption=Save As", ""
  !   !   'which is not generic:
  !   !   Window SetContext, "Current Window"
  !   !   'Get object name...
  !   !   'Is it save as? ...

  !   !   'Any other errors?
  !   !   Assert ...
  !   !   'If an error is found, stop! ...
  !   !   'Push a button that says "Save"
  !   !   PushButton Click, "Text=Save"

  !   SQADataPoolOpen
  !   Do while not EOF(1)
  !   !   'Fetch the next record from the datapool:
IBM Rational Robot
RobotJ (Java + libraries)
import resources.First_oneHelper;
import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.script.*;
import com.rational.test.ft.value.*;
import com.rational.test.ft.vp.*;
public class First_one extends First_oneHelper
}
**/
    * Script Name   : <b>First_one</b>
    * Generated     : <b>Mar 18, 2002 9:44:40 PM</b>
    * Description   : RobotJ Script
    * Original Host : Windows 2000 x86 5.0
    * Original Host : WinNT Version 5.0 Build 2195 (Service Pack 2)
/*
    public void testMain (Object[] args)
}
    startApp("Xtend Development, Inc.");
    consultingsmjpg_textVP().performTest();
   // Document: Xtend Development, Inc.: http://www.xtenddev.com/
    Link_SiteMap().click();
    Link_SearchEngine().click();
    Text_query().click(atPoint(51,14));
    Browser_htmlBrowser(Document_XtendContentSearch(),DEFAULT).inputKeys("rational");
    Button_Submit().click();
    Link_XtendOnDemandVideoLibrary().click();
    Document_XtendOnDemandVideoLib().drag(atPoint(754,247),atPoint(753,450));
    Link_VisualTest6Indepth().click();
    Document_VT6InDepthVideos().drag(atPoint(755,137),atPoint(754,203));
    Image_buygif().click();
    Button_CheckOutsubmit().click();
    Text_name().click(atPoint(29,13));
    name_textVP().performTest();
    Text_name().click(atPoint(35,10));
IBM Rational Robot
VU (Load & performance tests)
    set Server_connection = D10_91_46_90_6;

    http_header_recv ["Home020"]   200;       /* OK */

    http_nrecv ["Home021"] 100 %% ;          /* 2611 bytes */
    check_failure(_response, orgid, version_date, _script, _lineno);

    stop_time ["Home"]; /* Stop_Block */

    pop Http_control;
    Beginning of the next script:
    set Server_connection = D10_91_46_90_6; //I2

     /* Keep-Alive request over connection D10_91_46_90_6 */
    http_request ["CBDSum001"]
       "GET /baliweb_ver_" + http_url_encode(version_date) + "_UAT_P20_adc/xml/TB
          TxnHistoryWI.xml HTTP/1.1rn"
       "Accept: */*rn"
       "Referer: https://10.91.46.90/baliweb_ver_" + http_url_encode(version_date +
          "_UAT_P20_adc/site/lightho"
       "rz800/en/html/codegen/rn"
       "Accept-Encoding: gzip, deflatern"
       "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR"
       " 1.1.4322)rn"
       "Host: 10.91.46.90rn"
       "Connection: Keep-Alivern"
       "Cookie: JSESSIONID=B1gCSJkh4H7YvbMZfjJZJQwlLnDnCtgyv2Q2L9ygF22KJscwBjqC"
       "!-32148467!NONErn"
       "rn";
    start_time ["CBDSum"] _fs_ts;
Oracle Application Test Suite
         OpenScript
Better Alternatives for
    Test Scripting
       General purpose
     programming language
        Multi-platform
        Many libraries

         Open-source
Tester’s

                object-oriented
                   dynamic
             programming language
              simple from outside
 Yukihiro
Matsumoto
 or “Matz”      powerful inside
Simple but Powerful
Everything is object
5.times { print "We *love* Ruby -- it's outrageous!" }


                                         class Numeric
                                           def plus(x)
                                             self.+(x)
                       Flexible and        end
                        extensible       end

                                         y = 5.plus 6
                                         # y is now equal to 11
Iterators and blocks
search_engines =
  %w[Google Yahoo MSN].map do |engine|
    "http://www." + engine.downcase + ".com"
  end
Ruby platforms


       MRI         JRuby     IronRuby   MacRuby


Unix   Mac   Win   Java VM   MS .NET    Mac OS X
High Testing
Culture in Ruby
 Community

   TATFT
 Test All The F****** Time
High Testing
Culture in Ruby
 Community

   TATFT
 Test All The F****** Time
High Testing
Culture in Ruby
 Community

   TATFT
 Test All The F****** Time
High Testing
Culture in Ruby
 Community

   TATFT
 Test All The F****** Time
Test script examples
     with Ruby
Web Testing
               with Selenium
require "selenium/client"

describe "Google search" do
  before(:all) do
    @browser = Selenium::Client::Driver.new(:host => "localhost",:port => 4444,
      :browser => "*firefox",:url => "http://www.google.com")
  end
  before(:each) do
    @browser.start_new_browser_session
  end
  after(:each) do
    @browser.close_current_browser_session
  end

  it "should find Ruby programming language home page" do
    @browser.open "/"
    @browser.title.should == "Google"
    @browser.type "q", "ruby"
    @browser.click "btnG", :wait_for => :element, :element => 'rso'
    @browser.title.should =~ /^ruby - Google/
    @browser.text?("ruby-lang.org").should be_true
  end
end
... or with Watir
require "safariwatir"

describe "Google search" do
  before(:all) do
    @browser = Watir::Safari.new
  end
  after(:all) do
    @browser.close
  end
  before(:each) do
    @browser.goto "http://google.com"
  end

  it "should find Ruby programming language home page" do
    @browser.title.should == "Google"
    @browser.text_field(:name, "q").set "ruby"
    @browser.button(:name, "btnG").click
    @browser.title.should =~ /^ruby - Google/
    @browser.text.include?("ruby-lang.org").should be_true
  end
end
Tests as Executable
   Specification
require 'java'
          require 'jemmy.jar'
          require 'junquenote_app'

          java_import 'org.netbeans.jemmy.JemmyProperties'
          java_import 'org.netbeans.jemmy.TestOut'

          %w(Frame TextArea MenuBar Dialog Button).each do |o|
            java_import "org.netbeans.jemmy.operators.J#{o}Operator"
          end




 Java
          JemmyProperties.set_current_timeout 'DialogWaiter.WaitDialogTimeout', 1000
          JemmyProperties.set_current_output TestOut.get_null_output

          describe "Notes application" do
            def create_application
                                                                  Java
                                                                 classes
  GUI
              JunqueNoteApp.new
              @main_window = JFrameOperator.new 'JunqueNote'
            end

           def exit_application



testing
             menu = JMenuBarOperator.new @main_window
             menu.push_menu_no_block 'File|Exit', '|'
             if dialog = (JDialogOperator.new "Quittin' time" rescue nil)
               button = JButtonOperator.new dialog, "No"
               button.push
             end


  with
           end

           def edit_text_area
             JTextAreaOperator.new @main_window
           end



JRuby      before { create_application }
           after { exit_application }

           it 'launches with a welcome message' do
             edit_text_area.text.should =~ /Welcome/
           end

           it "allows to type in text" do
             original_text = edit_text_area.text
             edit_text_area.type_text "this is some text"
             edit_text_area.text.should == "this is some text#{original_text}"
           end

          end
describe "Remove rooms by name" do
                before(:all) do
                  plsql.rooms.insert_values(
                    [:room_key, :name],
                    [1, 'Dining Room'],

         tables
                    [2, 'Living Room'],




  Oracle
                    [3, 'Office'],
                    [4, 'Bathroom'],
                    [5, 'Bedroom']
                  )
                  plsql.room_contents.insert_values(
                    [:contents_key, :room_key, :name],




 PL/SQL
                    [1, 1, 'Table'],
                    [2, 1, 'Hutch'],
                    [3, 1, 'Chair'],
                    [4, 2, 'Sofa'],
                    [5, 2, 'Lamp'],
                    [6, 3, 'Desk'],

                                                  procedure
  Testing
                    [7, 3, 'Chair'],
                    [8, 3, 'Computer'],
                    [9, 3, 'Whiteboard']
                  )
                end                                  call

   with
                  it "should remove a room without furniture" do
                    rooms_without_b = plsql.rooms.all("WHERE name NOT LIKE 'B%'")
                    plsql.remove_rooms_by_name('B%')
                    plsql.rooms.all.should == rooms_without_b
                  end

                  it "should not remove a room with furniture" do



ruby-plsql-
                    lambda {
                      lambda {
                        plsql.remove_rooms_by_name('Living Room')
                      }.should raise_error(/ORA-02292/)
                    }.should_not change { plsql.rooms.all }
                  end



   spec           it "should raise exception when NULL value passed" do
                    lambda {
                      lambda {
                        plsql.remove_rooms_by_name(NULL)
                      }.should raise_error(/program error/)
                    }.should_not change { plsql.rooms.all }
                  end

              end
More information
     http://ruby-lang.org


  http://pragprog.com/titles/idgtr/
   scripted-gui-testing-with-ruby



   http://github.com/rsim/
       ruby-plsql-spec
1 of 25

Recommended

Rails on Oracle 2011 by
Rails on Oracle 2011Rails on Oracle 2011
Rails on Oracle 2011Raimonds Simanovskis
16.4K views24 slides
Rails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine by
Rails-like JavaScript Using CoffeeScript, Backbone.js and JasmineRails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript Using CoffeeScript, Backbone.js and JasmineRaimonds Simanovskis
19.5K views62 slides
Testing Backbone applications with Jasmine by
Testing Backbone applications with JasmineTesting Backbone applications with Jasmine
Testing Backbone applications with JasmineLeon van der Grient
1.9K views23 slides
Using Ruby on Rails with legacy Oracle databases by
Using Ruby on Rails with legacy Oracle databasesUsing Ruby on Rails with legacy Oracle databases
Using Ruby on Rails with legacy Oracle databasesRaimonds Simanovskis
7.3K views17 slides
FalsyValues. Dmitry Soshnikov - ECMAScript 6 by
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
30.5K views58 slides
Reactive Access to MongoDB from Scala by
Reactive Access to MongoDB from ScalaReactive Access to MongoDB from Scala
Reactive Access to MongoDB from ScalaHermann Hueck
3.1K views61 slides

More Related Content

What's hot

Scala active record by
Scala active recordScala active record
Scala active record鉄平 土佐
6.3K views84 slides
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015 by
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015Fernando Hamasaki de Amorim
16.3K views141 slides
Introduction to Nodejs by
Introduction to NodejsIntroduction to Nodejs
Introduction to NodejsGabriele Lana
17.6K views69 slides
Http4s, Doobie and Circe: The Functional Web Stack by
Http4s, Doobie and Circe: The Functional Web StackHttp4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web StackGaryCoady
6.3K views33 slides
Node Boot Camp by
Node Boot CampNode Boot Camp
Node Boot CampTroy Miles
871 views102 slides
Workshop 1: Good practices in JavaScript by
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptVisual Engineering
963 views45 slides

What's hot(20)

Introduction to Nodejs by Gabriele Lana
Introduction to NodejsIntroduction to Nodejs
Introduction to Nodejs
Gabriele Lana17.6K views
Http4s, Doobie and Circe: The Functional Web Stack by GaryCoady
Http4s, Doobie and Circe: The Functional Web StackHttp4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web Stack
GaryCoady6.3K views
Node Boot Camp by Troy Miles
Node Boot CampNode Boot Camp
Node Boot Camp
Troy Miles871 views
Annotation processing and code gen by koji lin
Annotation processing and code genAnnotation processing and code gen
Annotation processing and code gen
koji lin1.2K views
RubyEnRails2007 - Dr Nic Williams - Keynote by Dr Nic Williams
RubyEnRails2007 - Dr Nic Williams - KeynoteRubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - Keynote
Dr Nic Williams2.8K views
G*ワークショップ in 仙台 Grails(とことん)入門 by Tsuyoshi Yamamoto
G*ワークショップ in 仙台 Grails(とことん)入門G*ワークショップ in 仙台 Grails(とことん)入門
G*ワークショップ in 仙台 Grails(とことん)入門
Tsuyoshi Yamamoto1.6K views
Say Hello To Ecmascript 5 by Juriy Zaytsev
Say Hello To Ecmascript 5Say Hello To Ecmascript 5
Say Hello To Ecmascript 5
Juriy Zaytsev14.5K views
5 Tips for Better JavaScript by Todd Anglin
5 Tips for Better JavaScript5 Tips for Better JavaScript
5 Tips for Better JavaScript
Todd Anglin72.5K views
Mastering Java Bytecode With ASM - 33rd degree, 2012 by Anton Arhipov
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012
Anton Arhipov8K views
Testing your javascript code with jasmine by Rubyc Slides
Testing your javascript code with jasmineTesting your javascript code with jasmine
Testing your javascript code with jasmine
Rubyc Slides1.2K views
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter... by Domenic Denicola
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Domenic Denicola184.2K views
Mobile Open Day: React Native: Crossplatform fast dive by epamspb
Mobile Open Day: React Native: Crossplatform fast diveMobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast dive
epamspb306 views
Ten useful JavaScript tips & best practices by Ankit Rastogi
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practices
Ankit Rastogi3.5K views

Similar to Why Every Tester Should Learn Ruby

soft-shake.ch - Hands on Node.js by
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
2.3K views35 slides
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018 by
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018Codemotion
81 views52 slides
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus... by
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...bobmcwhirter
1.6K views94 slides
General Functions by
General FunctionsGeneral Functions
General FunctionsBabuDevanandam
391 views67 slides
JavaScript Growing Up by
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
14.1K views57 slides
A tour on ruby and friends by
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends旻琦 潘
936 views61 slides

Similar to Why Every Tester Should Learn Ruby(20)

soft-shake.ch - Hands on Node.js by soft-shake.ch
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
soft-shake.ch2.3K views
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018 by Codemotion
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Codemotion81 views
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus... by bobmcwhirter
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
bobmcwhirter1.6K views
JavaScript Growing Up by David Padbury
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
David Padbury14.1K views
A tour on ruby and friends by 旻琦 潘
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends
旻琦 潘936 views
Node.js - async for the rest of us. by Mike Brevoort
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
Mike Brevoort6.9K views
How to Begin Developing Ruby Core by Hiroshi SHIBATA
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby Core
Hiroshi SHIBATA1.9K views
Workshop 23: ReactJS, React & Redux testing by Visual Engineering
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testing
Visual Engineering1.8K views
Playing With Fire - An Introduction to Node.js by Mike Hagedorn
Playing With Fire - An Introduction to Node.jsPlaying With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.js
Mike Hagedorn1K views
React Native Evening by Troy Miles
React Native EveningReact Native Evening
React Native Evening
Troy Miles542 views
Taking Jenkins Pipeline to the Extreme by yinonavraham
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extreme
yinonavraham498 views
Writing robust Node.js applications by Tom Croucher
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
Tom Croucher15.6K views
Intro To JavaScript Unit Testing - Ran Mizrahi by Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
Ran Mizrahi2.4K views

More from Raimonds Simanovskis

Profiling Mondrian MDX Requests in a Production Environment by
Profiling Mondrian MDX Requests in a Production EnvironmentProfiling Mondrian MDX Requests in a Production Environment
Profiling Mondrian MDX Requests in a Production EnvironmentRaimonds Simanovskis
1.1K views25 slides
Improve Mondrian MDX usability with user defined functions by
Improve Mondrian MDX usability with user defined functionsImprove Mondrian MDX usability with user defined functions
Improve Mondrian MDX usability with user defined functionsRaimonds Simanovskis
1.7K views21 slides
Analyze and Visualize Git Log for Fun and Profit - DevTernity 2015 by
Analyze and Visualize Git Log for Fun and Profit - DevTernity 2015Analyze and Visualize Git Log for Fun and Profit - DevTernity 2015
Analyze and Visualize Git Log for Fun and Profit - DevTernity 2015Raimonds Simanovskis
2.8K views40 slides
Data Warehouses and Multi-Dimensional Data Analysis by
Data Warehouses and Multi-Dimensional Data AnalysisData Warehouses and Multi-Dimensional Data Analysis
Data Warehouses and Multi-Dimensional Data AnalysisRaimonds Simanovskis
2.9K views59 slides
mondrian-olap JRuby library by
mondrian-olap JRuby librarymondrian-olap JRuby library
mondrian-olap JRuby libraryRaimonds Simanovskis
1.2K views26 slides
eazyBI Overview - Embedding Mondrian in other applications by
eazyBI Overview - Embedding Mondrian in other applicationseazyBI Overview - Embedding Mondrian in other applications
eazyBI Overview - Embedding Mondrian in other applicationsRaimonds Simanovskis
2.1K views19 slides

More from Raimonds Simanovskis(20)

Profiling Mondrian MDX Requests in a Production Environment by Raimonds Simanovskis
Profiling Mondrian MDX Requests in a Production EnvironmentProfiling Mondrian MDX Requests in a Production Environment
Profiling Mondrian MDX Requests in a Production Environment
Improve Mondrian MDX usability with user defined functions by Raimonds Simanovskis
Improve Mondrian MDX usability with user defined functionsImprove Mondrian MDX usability with user defined functions
Improve Mondrian MDX usability with user defined functions
Analyze and Visualize Git Log for Fun and Profit - DevTernity 2015 by Raimonds Simanovskis
Analyze and Visualize Git Log for Fun and Profit - DevTernity 2015Analyze and Visualize Git Log for Fun and Profit - DevTernity 2015
Analyze and Visualize Git Log for Fun and Profit - DevTernity 2015
Data Warehouses and Multi-Dimensional Data Analysis by Raimonds Simanovskis
Data Warehouses and Multi-Dimensional Data AnalysisData Warehouses and Multi-Dimensional Data Analysis
Data Warehouses and Multi-Dimensional Data Analysis
eazyBI Overview - Embedding Mondrian in other applications by Raimonds Simanovskis
eazyBI Overview - Embedding Mondrian in other applicationseazyBI Overview - Embedding Mondrian in other applications
eazyBI Overview - Embedding Mondrian in other applications
opendata.lv Case Study - Promote Open Data with Analytics and Visualizations by Raimonds Simanovskis
opendata.lv Case Study - Promote Open Data with Analytics and Visualizationsopendata.lv Case Study - Promote Open Data with Analytics and Visualizations
opendata.lv Case Study - Promote Open Data with Analytics and Visualizations
Extending Oracle E-Business Suite with Ruby on Rails by Raimonds Simanovskis
Extending Oracle E-Business Suite with Ruby on RailsExtending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on Rails
RailsWayCon: Multidimensional Data Analysis with JRuby by Raimonds Simanovskis
RailsWayCon: Multidimensional Data Analysis with JRubyRailsWayCon: Multidimensional Data Analysis with JRuby
RailsWayCon: Multidimensional Data Analysis with JRuby
Raimonds Simanovskis17.2K views
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine by Raimonds Simanovskis
Rails-like JavaScript using CoffeeScript, Backbone.js and JasmineRails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Multidimensional Data Analysis with Ruby (sample) by Raimonds Simanovskis
Multidimensional Data Analysis with Ruby (sample)Multidimensional Data Analysis with Ruby (sample)
Multidimensional Data Analysis with Ruby (sample)

Recently uploaded

KVM Security Groups Under the Hood - Wido den Hollander - Your.Online by
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineShapeBlue
102 views19 slides
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...ShapeBlue
46 views29 slides
DRBD Deep Dive - Philipp Reisner - LINBIT by
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBITShapeBlue
62 views21 slides
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueShapeBlue
85 views54 slides
Kyo - Functional Scala 2023.pdf by
Kyo - Functional Scala 2023.pdfKyo - Functional Scala 2023.pdf
Kyo - Functional Scala 2023.pdfFlavio W. Brasil
434 views92 slides
20231123_Camunda Meetup Vienna.pdf by
20231123_Camunda Meetup Vienna.pdf20231123_Camunda Meetup Vienna.pdf
20231123_Camunda Meetup Vienna.pdfPhactum Softwareentwicklung GmbH
46 views73 slides

Recently uploaded(20)

KVM Security Groups Under the Hood - Wido den Hollander - Your.Online by ShapeBlue
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
ShapeBlue102 views
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by ShapeBlue
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
ShapeBlue46 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue62 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue85 views
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... by ShapeBlue
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
ShapeBlue63 views
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by IttrainingIttraining
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
ShapeBlue46 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software344 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue96 views
Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman40 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue111 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu141 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson133 views
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue91 views
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue74 views

Why Every Tester Should Learn Ruby

  • 2. Agile Open- Technology source github.com/rsim Ruby JavaScript Raimonds Simanovskis @rsim .com
  • 4. Who are testers? ... or automation ninjas who create robots?
  • 6. HP (former Mercury) VBScript dialect
  • 7. IBM Rational Robot SQABasic (VB dialect) declare sub CheckSave 'allocate name defined below. '$Include "sqautil.sbh" 'used for datapool scripts. '$Include "global.sbh" 'used by all scripts. Sub Main ! Dim Result As Integer ! 'Explicitly declare variable: ! ! dim strOpSys As String, strFileName As String ! ! dim strScriptUsed As String, strReturn As Integer ! ! const SCRIPTUSED As String = "Using Script 5/8/99" ! 'Assuming that the application is opened by the calling module: ! 'Press Alt-File, Save As to open dialog box: ! ! InputKeys %"FA" ! ! ' MenuSelect "File->Save As..." not used ! 'Analyze pop-up window to detect and handle unexpected dialog: ! ! 'Instead of Window SetContext, "Caption=Save As", "" ! ! 'which is not generic: ! ! Window SetContext, "Current Window" ! ! 'Get object name... ! ! 'Is it save as? ... ! ! 'Any other errors? ! ! Assert ... ! ! 'If an error is found, stop! ... ! ! 'Push a button that says "Save" ! ! PushButton Click, "Text=Save" ! SQADataPoolOpen ! Do while not EOF(1) ! ! 'Fetch the next record from the datapool:
  • 8. IBM Rational Robot RobotJ (Java + libraries) import resources.First_oneHelper; import com.rational.test.ft.*; import com.rational.test.ft.object.interfaces.*; import com.rational.test.ft.script.*; import com.rational.test.ft.value.*; import com.rational.test.ft.vp.*; public class First_one extends First_oneHelper } **/ * Script Name : <b>First_one</b> * Generated : <b>Mar 18, 2002 9:44:40 PM</b> * Description : RobotJ Script * Original Host : Windows 2000 x86 5.0 * Original Host : WinNT Version 5.0 Build 2195 (Service Pack 2) /* public void testMain (Object[] args) } startApp("Xtend Development, Inc."); consultingsmjpg_textVP().performTest(); // Document: Xtend Development, Inc.: http://www.xtenddev.com/ Link_SiteMap().click(); Link_SearchEngine().click(); Text_query().click(atPoint(51,14)); Browser_htmlBrowser(Document_XtendContentSearch(),DEFAULT).inputKeys("rational"); Button_Submit().click(); Link_XtendOnDemandVideoLibrary().click(); Document_XtendOnDemandVideoLib().drag(atPoint(754,247),atPoint(753,450)); Link_VisualTest6Indepth().click(); Document_VT6InDepthVideos().drag(atPoint(755,137),atPoint(754,203)); Image_buygif().click(); Button_CheckOutsubmit().click(); Text_name().click(atPoint(29,13)); name_textVP().performTest(); Text_name().click(atPoint(35,10));
  • 9. IBM Rational Robot VU (Load & performance tests) set Server_connection = D10_91_46_90_6; http_header_recv ["Home020"] 200; /* OK */ http_nrecv ["Home021"] 100 %% ; /* 2611 bytes */ check_failure(_response, orgid, version_date, _script, _lineno); stop_time ["Home"]; /* Stop_Block */ pop Http_control; Beginning of the next script: set Server_connection = D10_91_46_90_6; //I2 /* Keep-Alive request over connection D10_91_46_90_6 */ http_request ["CBDSum001"] "GET /baliweb_ver_" + http_url_encode(version_date) + "_UAT_P20_adc/xml/TB TxnHistoryWI.xml HTTP/1.1rn" "Accept: */*rn" "Referer: https://10.91.46.90/baliweb_ver_" + http_url_encode(version_date + "_UAT_P20_adc/site/lightho" "rz800/en/html/codegen/rn" "Accept-Encoding: gzip, deflatern" "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR" " 1.1.4322)rn" "Host: 10.91.46.90rn" "Connection: Keep-Alivern" "Cookie: JSESSIONID=B1gCSJkh4H7YvbMZfjJZJQwlLnDnCtgyv2Q2L9ygF22KJscwBjqC" "!-32148467!NONErn" "rn"; start_time ["CBDSum"] _fs_ts;
  • 10. Oracle Application Test Suite OpenScript
  • 11. Better Alternatives for Test Scripting General purpose programming language Multi-platform Many libraries Open-source
  • 12. Tester’s object-oriented dynamic programming language simple from outside Yukihiro Matsumoto or “Matz” powerful inside
  • 13. Simple but Powerful Everything is object 5.times { print "We *love* Ruby -- it's outrageous!" } class Numeric def plus(x) self.+(x) Flexible and end extensible end y = 5.plus 6 # y is now equal to 11 Iterators and blocks search_engines = %w[Google Yahoo MSN].map do |engine| "http://www." + engine.downcase + ".com" end
  • 14. Ruby platforms MRI JRuby IronRuby MacRuby Unix Mac Win Java VM MS .NET Mac OS X
  • 15. High Testing Culture in Ruby Community TATFT Test All The F****** Time
  • 16. High Testing Culture in Ruby Community TATFT Test All The F****** Time
  • 17. High Testing Culture in Ruby Community TATFT Test All The F****** Time
  • 18. High Testing Culture in Ruby Community TATFT Test All The F****** Time
  • 19. Test script examples with Ruby
  • 20. Web Testing with Selenium require "selenium/client" describe "Google search" do before(:all) do @browser = Selenium::Client::Driver.new(:host => "localhost",:port => 4444, :browser => "*firefox",:url => "http://www.google.com") end before(:each) do @browser.start_new_browser_session end after(:each) do @browser.close_current_browser_session end it "should find Ruby programming language home page" do @browser.open "/" @browser.title.should == "Google" @browser.type "q", "ruby" @browser.click "btnG", :wait_for => :element, :element => 'rso' @browser.title.should =~ /^ruby - Google/ @browser.text?("ruby-lang.org").should be_true end end
  • 21. ... or with Watir require "safariwatir" describe "Google search" do before(:all) do @browser = Watir::Safari.new end after(:all) do @browser.close end before(:each) do @browser.goto "http://google.com" end it "should find Ruby programming language home page" do @browser.title.should == "Google" @browser.text_field(:name, "q").set "ruby" @browser.button(:name, "btnG").click @browser.title.should =~ /^ruby - Google/ @browser.text.include?("ruby-lang.org").should be_true end end
  • 22. Tests as Executable Specification
  • 23. require 'java' require 'jemmy.jar' require 'junquenote_app' java_import 'org.netbeans.jemmy.JemmyProperties' java_import 'org.netbeans.jemmy.TestOut' %w(Frame TextArea MenuBar Dialog Button).each do |o| java_import "org.netbeans.jemmy.operators.J#{o}Operator" end Java JemmyProperties.set_current_timeout 'DialogWaiter.WaitDialogTimeout', 1000 JemmyProperties.set_current_output TestOut.get_null_output describe "Notes application" do def create_application Java classes GUI JunqueNoteApp.new @main_window = JFrameOperator.new 'JunqueNote' end def exit_application testing menu = JMenuBarOperator.new @main_window menu.push_menu_no_block 'File|Exit', '|' if dialog = (JDialogOperator.new "Quittin' time" rescue nil) button = JButtonOperator.new dialog, "No" button.push end with end def edit_text_area JTextAreaOperator.new @main_window end JRuby before { create_application } after { exit_application } it 'launches with a welcome message' do edit_text_area.text.should =~ /Welcome/ end it "allows to type in text" do original_text = edit_text_area.text edit_text_area.type_text "this is some text" edit_text_area.text.should == "this is some text#{original_text}" end end
  • 24. describe "Remove rooms by name" do before(:all) do plsql.rooms.insert_values( [:room_key, :name], [1, 'Dining Room'], tables [2, 'Living Room'], Oracle [3, 'Office'], [4, 'Bathroom'], [5, 'Bedroom'] ) plsql.room_contents.insert_values( [:contents_key, :room_key, :name], PL/SQL [1, 1, 'Table'], [2, 1, 'Hutch'], [3, 1, 'Chair'], [4, 2, 'Sofa'], [5, 2, 'Lamp'], [6, 3, 'Desk'], procedure Testing [7, 3, 'Chair'], [8, 3, 'Computer'], [9, 3, 'Whiteboard'] ) end call with it "should remove a room without furniture" do rooms_without_b = plsql.rooms.all("WHERE name NOT LIKE 'B%'") plsql.remove_rooms_by_name('B%') plsql.rooms.all.should == rooms_without_b end it "should not remove a room with furniture" do ruby-plsql- lambda { lambda { plsql.remove_rooms_by_name('Living Room') }.should raise_error(/ORA-02292/) }.should_not change { plsql.rooms.all } end spec it "should raise exception when NULL value passed" do lambda { lambda { plsql.remove_rooms_by_name(NULL) }.should raise_error(/program error/) }.should_not change { plsql.rooms.all } end end
  • 25. More information http://ruby-lang.org http://pragprog.com/titles/idgtr/ scripted-gui-testing-with-ruby http://github.com/rsim/ ruby-plsql-spec