SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
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;
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
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
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