Archive

Posts Tagged ‘test automation’

WTANZ: “Test automation series”

October 17, 2010 Leave a comment

Since the seventh session, the WTANZ topics have all been geared towards test automation.

  • WTANZ07 (Jul 25) offered an introduction to watir. Here we tried to automate simple tasks like logging in, finding a forum and then posting a reply to it.
  • WTANZ08 (Aug 22) was sort of a continuation of the previous session. Here the mission was to find a bug and then write a failing test for it. This session also provided a mini refactoring lesson for me since I placed the task of calling a particular function and the actual test under just one function. In retrospect, (I think Marlena also pointed this out) this session would have been a good time to try out assertions.
  • WTANZ09 (Sep 19) was another session on watir. I missed this session but I did get to read a bit about it through Marlena’s blog post.
  • WTANZ10 (Oct 17) earlier today was an introduction to Cucumber and Gherkin. From what I understand, Cucumber is the tool that does the automated test execution, whereas Gherkin is the language used to define the tests and it’s the language that cucumber understands. With the use of gherkin, test scenarios can be described in the format Given-When-Then-. And being in plain English, the business analyst can then supposedly be requested to write the test scenarios that he expects. Gherkin reminded me of Fitnesse wherein non-programmers are said to be able to write test cases in wiki format. For both tools, I guess the technical part of the actual automation is obscured from the non-programmers allowing them to focus on the scenarios or inputs that they would like to test.

Links:

Categories: exercise Tags: ,

WTANZ07: Watir basics

July 26, 2010 1 comment

For this Sunday’s weekend testing session, Oliver introduced the group to a web test automation tool called Watir which works with Ruby. I also found out that this session will be a precursor for yet another session for a test automation tool called Cucumber but the next session will be four weeks away though. I’m digressing. Anyways, as a prerequisite (supposedly), we were asked to install ruby and watir onto our workstations following instructions laid out in http://watir.com/installation/#win.

The session started off with Oliver walking us through with some basic commands, then afterwards he let us work on our own on a mission to use watir for posting a forum reply in weekendtesting.com.  I had some trouble at first. For one, when I worked with IE7, one of the commands (b.text.include? "<text>") just kept returning false. I’m guessing watir was still looking at the blank tab rather than at the tab where the test web page was launched. I then tried using Firefox instead but I was getting an error message on jssh even though I’ve just installed the plug-in as indicated in the watir installation site. I later realized that I had two versions of Firefox and the command Watir::Browser.new seemed to be opening the older one which didn’t have the plug-in installed. After getting that sorted out, it was pretty much smooth sailing. :)

Here’s a summary of commands I used in the session:

require "watir"

Watir::Browser.default = "firefox"

b = Watir::Browser.new
b.goto("http://weekendtesting.com")

# Find text
b.text.include? "Forum"

# Click links
b.link(:text, "Forum").click
b.link(:text, /Next Weekend/).click

# Log in
b.text_field(:id, "user_login").set "<username>"
b.text_field(:id, "user_pass").set "<password>"
b.button(:value, "Log In").click

# Post a reply for the WTANZ07 topic
# Would only work if the topic is still in the list of Ongoing Discussions
# Searching for "WTANZ session #07" didn't work (even thru manual approach)
b.link(:text, "Forum").click
b.link(:text, /WTANZ session.*07/).click
b.link(:text, "Reply").click
b.text_field(:name, "message").set("Test reply yada yada blah blah")
b.button(:value, "Submit").click

# Log out
b.link(:text, /Logout/).click

Right after the session, I found some more links on watir to check out later when I have time. :p

Categories: exercise Tags: , ,
Follow

Get every new post delivered to your Inbox.