Download - Teaching Scripting to Testers
![Page 1: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/1.jpg)
Teaching Scripting to Testers
Copyright © 2004 Bret Pettichord & Brian Marick. Permission to reproduce granted under the TestingEducation.com license.
Workshop on Teaching Software Testing, Melbourne, Florida, February 2004
Bret Pettichord([email protected], www.pettichord.com)
Brian Marick ([email protected], www.testing.com)
![Page 2: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/2.jpg)
2
Agenda
Tutorial StructureCreating an Ad Hoc LabTutorial MaterialsTutorial EvolutionWho Benefits?Changes PlannedRuby and Our Toolkit
![Page 3: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/3.jpg)
3
Agenda for One-Day Tutorial
A series of hands-on exercises:Manual TestingUsing IRB and IE ControllerWriting ScriptsWeb Services
For each exercise:2. Show students how to
do a task Often improvised
3. Provide reference material
4. Give students a specific goal and have them give it a go
5. Provide impromptu demos if they get stuck
![Page 4: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/4.jpg)
4
Educational Objectives
Hands-on experience writing automated test scriptsOvercome fear of programmingDevelop skill rather than just provide knowledgeLearn benefits of scripting languagesUnderstand value of different interfaces for testing
GUI vs CLI vs API vs Web vs Web Service
![Page 5: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/5.jpg)
5
Browser Automation
Use the COM Automation interface to Internet Explorer
Web Server
InternetExplorer
IE Controller& Ruby
AutomationInterface
Tests drive the browser
![Page 6: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/6.jpg)
6
A snippet
require 'iec'
start_ie("http://localhost:8080")
get_forms[0].name = "bret"
submit_form(get_forms[0])
![Page 7: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/7.jpg)
7
Class History
October 2003STAR WestSan Jose
October 2003PNSQCPortland, Oregon
May 2003STAR EastOrlando
![Page 8: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/8.jpg)
8
Building the Ad Hoc Lab
Students provide Windows laptopsInstructors provide: Wired/Wireless Network
Router, Hubs, Cables Laptop (Mac) running web server Projector
![Page 9: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/9.jpg)
9
Problems with Student Laptops
May: Old Creaky Laptops No CD drive No Network Card Flaky Behavior
Oct: Increased Network Security Firewalls Proxies Unusual Network Software Configurations
Also: Easier to distribute files from Mac than Windows!
![Page 10: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/10.jpg)
10
What’s on the CD
Software Ruby 1.6.8 (Matz, Thomas, Hunt) Timeclock (Marick) Distributed Ruby (Seki) IE Controller (Morris) Tutorial Example Solutions
(Pettichord, Marick)
Books and Articles Programming with Ruby
(Thomas, Hunt) “Programming in Ruby” (Thomas,
Hunt) “Bypassing the GUI” (Marick)
Tutorial Handouts Brief example-
based documentation (“cheat sheets”)
Lab exercises
We’ve also used a few slides
![Page 11: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/11.jpg)
11
Ruby Cheat Sheet
VariablesConditionalsFunction callsFunction definitionsVery simply regular expressionsTruth and falsehoodObjects and methods and messagesArraysDictionariesIteration
![Page 12: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/12.jpg)
12
Spring TutorialAgenda
Show Web browser interface and GUI (on Mac)Teach how to test CLITeach Ruby and IRBTeach xUnit test harnessTeach how to test Web service interfaceFinish with testing Web browser interface
Guts
BrowserCommandLine
CocoaGUI
![Page 13: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/13.jpg)
13
Changes from Spring to Fall
Start with Web Browser Testing Students really took to it Felt most like testing Direct feedback using IRBDrop language theory What a class is Difference between a method and a
message Students didn’t need it
![Page 14: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/14.jpg)
14
Who Benefits?
Designed for testers scared of programmingWorked better for testers with some programming experienceExperienced programmers were able to run ahead and stay engagedRequires two instructors for classes of 30 students
![Page 15: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/15.jpg)
15
Pair Programming
We suggested that students pair programThey mostly resistedLaptop requirement made students committed to using their laptopsProblem with “bad pair”
![Page 16: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/16.jpg)
16
Changes Planned
Don’t require connection to networkUse USB drives to share code and encourage pairingTeach pair programming as a techniqueAdd names to Timeclock controlsDrop web services materialConclude with language comparison and technical overview of IE ControllerOrganize and improve suggested solutions Also, put them all in a regression suite
Update to Ruby 1.8 and newest WTRImprove installation docs & software Problems using DOS CLI
IE Controller (WTR) improvements Resolve interface disputes
![Page 17: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/17.jpg)
17
New Homebrew Tutorial
Survey scripting languages and open source test tools
http://www.io.com/~wazmo/papers/homebrew_test_automation_200311.pdf
Use Ruby WTR as basis for exemplar test suiteCreate demo test suite with examples of different kinds of tests functional, concurrency, scenario
Use STAF for distributed testingPlan to teach through local groups (e.g. SPINs)
![Page 18: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/18.jpg)
18
Scripting Languages
**
**
***
Func
*½
*
*
**
***
OO
***
***
***
**
*
Mature
*
?
*
**
***
FreeDoc
VBScript
?***TCL
?Perl
*****Python
*****Ruby
Templating
COMDynLineInterp
Free
![Page 19: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/19.jpg)
19
Building Your Own
Any decent language can call Internet Explorer’s COM Automation interface.Many applications built with Microsoft technology have COM Automation interfaces.There are equivalent interface mechanisms for other technologies.Perl example Samie (Wasserman) http://samie.sourceforge.net/
![Page 20: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/20.jpg)
20
IE Controller / WTR
Wiki http://www.clabs.org/wtr/
Mailing List http://rubyforge.org/projects/wtr/
Overview http://www.rubygarden.org/ruby?IeController
![Page 21: Teaching Scripting to Testers](https://reader033.vdocuments.site/reader033/viewer/2022042715/5596da4e1a28abcb6a8b45c5/html5/thumbnails/21.jpg)
21
IE Automation Referencehttp://msdn.microsoft.com/workshop/browser/webbrowser/reference/Objects/InternetExplorer.asp