Posts Tagged ‘scripting’

Book Review: Scripted GUI Testing with Ruby, by Ian Dees, published by Pragmatic Programmers, 192 pages, Aug. 2008, ISBN: 978-1-9343561-8-0, US $34.95

All software should be rigorously tested, during the development process, and before it is released. Automated testing helps software developers, testing teams and quality control (QC) teams perform comprehensive and effective testing, and find bugs quickly. This new book from the Pragmatic Bookshelf (in the Facets of Ruby Series) documents and demonstrates how to use the Ruby scripting language to test user interfaces reliably and repeatedly. The book covers a wide scope of testing needs, including techniques for scripted testing of MS-Windows GUIs, Java platform GUIs (for Linux, Mac, Windows, and others), or for web applications.

Book cover - Scripted GUI Testing with Ruby

Book cover - Scripted GUI Testing with Ruby

This book is a practical, quick moving tutorial based on real life, and real-world GUI applications.  Author Ian Dees says, “This is the book I wish I had four years ago. That’s when I faced the equally unpleasant task of fixing old, broken GUI tests and coaxing a rickety third-party toolkit into running new tests. I started looking for a how-to guide on GUI testing to help me down this road. Unfortunately, there were none.”  So Ian wrote the book he was wishing for.

Mr. Dees points out in the introduction (p.4) that many developers and software professionals have been suspicious or skeptical about test driven development (TDD). However, as he points out, “the important idea in TDD wasn’t the tests; it was the fact that writing the tests forces developers to think through how their code will behave.” After TDD, some people shifted their thought process, and began to speak of “behavior driven development” (BDD).  As it turns out, Ruby is a very powerful and expressive language for scripting tests, and RSpec is a special Ruby tool in the Ruby coders toolbox. “RSpec was the first Ruby implementation of the ideas behind BDD.”

Many examples and test scripts are sprinkled throughout the book.

Chapter 2 covers some simple examples with MS-Windows, and Java Swing (the original Sun Java GUI widgets) with JRuby and lays a nice foundation for the variety of tests that can be performed with Ruby.

Chapter 3 provides more in depth coverage of how to use RSpec, which is a Ruby gem (or library), that turns Ruby into a powerful (yet simple) test description language. RSpec notation uses words like “describe” – for describing the test, and “should” – a verb for describing how if the test passes or fails.

Chapter 4 provides details on how to simplify your testing, and Chapter 5 provides many examples for special cases like testing passwords, wrangling documents, cutting and pasting, or searching and replacing  (all under Ruby script control) to exercise many different tests of your application.

Chapter 6 and 7 provide more details about testing many kinds of apps, testing your tests, testing keystrokes, menus, mouse-clicks, and how to introduce randomness into the testing scenario.  Chapter 8 delves into using FIT (Ward Cunningham’s Framework for Integrated Testing). Fortunately, there is a Ruby gem for FIT testing also, and Mr. Dees demonstrates how easy it is to utilize simple HTML tables to visualize your testing.

Chapter 9 moves into testing web applications by impersonating a browser, parsing the HTML, or driving the actual browser to perform specific behaviors. There are several great pointers and examples on how to use Selenium, and Selenium with RSpec, and example scenarios with AJAX also (going way beyond the simple HTML page load tests). Another great Ruby browser/web-site testing tool called Watir (Web Application Testing in Ruby) is also described. This is a great chapter. The testing techniques in chapter 9 are worth the price of the book, so if you buy the book, and only read chapter 9, you will be receiving great value.

The book has several more chapters describing RSpec Story Runner, specialized testing on the MAC, and alternate GUI testing for the MS-Windows platform, with Win32::GuiTest. The book concludes with a bibliography, nice summary of resources, and helpful websites related to Ruby and software testing, and an index of contents in the book.

Bonus: Rails Podcasts has an MP3 you can download – an interview with author Ian Dees about Scripted GUI Testing with Ruby.

Maybe you figured out that I love jazz. I enjoy many musical genres, and musical styles, but lately I’ve been really exploring jazz. In a recent article I described jazz as being full of  images, mirrors, and reflections.  Jazz is like a bridge — always going from someplace to another place. Jazz is always asking questions, bending notes, refactoring routines, revisiting and revising themes, and making analogies. Jazz energizes me with its innovative musical poetry of patterns, parallels and allegories.

Jazz Piano Art - found at Detroit River Days

Jazz Piano Art - found at Detroit River Days

Back in April, I started talking about creativity, innovation, improvisation … and how it relates to jazz and the blues… meditating on the mysteries of musical creativity  … compared to creativity , innovation, and risk taking in other domains (like art, architecture, design, entrepreneurship, computer programming, product design, web design, etc.) … pondering the amazing results that often happen when a skilled musician begins  to improvise with a good idea and the right attitude.

Surprising success and fantastic results can happen in your life (or your business) when you understand how it all works.  Innovation – It’s not a new idea, and I’m not the only one talking about this. I’m just improvising on a great theme.

Nick Sieger (no relation to the Detroit rocker Bob Seger) wrote a great article in July called Jazzers and Programmers. I found Nick’s article while researching some things about Ruby on Rails, and JRuby.  NIck describes the history and styles of jazz and compares it to the history and styles of programming. He talks about jazz fundamentals, and compares the rhythm section (piano, bass, and drums)  to programming libraries, frameworks, and patterns. He compares Bass-Drums-Piano to Model-View-Controller. It’s really great stuff — and even includes a musical score from one of the jazz standards, Blue Monk.

Nick spiced up the article with nifty quotes from famous jazz musicians like: “It’s taken me my whole life to know what not to play” – Dizzy Gillespie … “Anyone can make the simple complicated. Creativity is making the complicated simple” – Charles Mingus  …  I won’t steal anymore of Nick’s thunder. Go read the whole article.

Are you catching my drift? We’re not done with this jam session yet. I’m just taking a breather in between songs.

PHP, JavaScript, Ruby, Perl, Python, and Tcl Today: The State of the Scripting Universe

Three years ago, Lynn Greiner at CIO Magazine, interviewed the big cheeses responsible for the popular scripting languages PHP, Perl, Tcl, Python, Ruby and JavaScript to find out where the languages were headed. In this follow-up discussion, she asks the dynamic language luminaries what has changed since then.

… and discussion of the article continues at Slashdot.

This is a test of PHP Script Syntax Highlighting with the GeSHi code colorizing and syntax parsing library, along with the WP-Syntax plugin.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//
// Include the GeSHi library
//
include_once 'geshi.php';
//
// Define some source to highlight, a language to use
// and the path to the language files
//
$source = '$foo = 45;
for ( $i = 1; $i < $foo; $i++ ){
echo "$foon";  --$foo;
}';
 
$language = 'php';
 
// Create a GeSHi object
 
$geshi = new GeSHi($source, $language);
 
// And echo the result!//
echo $geshi->parse_code();