Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Hugh McGowan
RE: Organizing test fixtures [ reply ]  
2008-10-18 04:33
The data is executed left to right or top to bottom depending on how you orient your spreadsheet. You can mix instance variables and methods however you like so you could set some variables, execute some methods, set more variables, etc, all in the same record.

You can disable a tab by coloring the tab or starting the tab name with '#'. If you add a header called 'pending' and put any data in the record's cell it will skip it and note it in the results. Any italicized cells are completely ignored as if they didn't exist. You should take a look at the examples for some sample data.

For now it's just a windows app but I'm planning to look into integrating this with roo or something similar so we can support open office/google spreadsheets which should open up the supported platforms.

By: Robert Stagner
RE: Organizing test fixtures [ reply ]  
2008-10-18 01:30
Great to know that I can reuse the same class!! I do have some additional questions for you, if you have the time. They are as follows:

* does Rasta execute the data contained in the Excel worksheets in any particular order? That is to say, if I've got serveral worksheets to test, does Rasta read from the first worksheet to the last (left to right) before completing the test?

* how do I go about "disabling" a worksheet?

* if I've got several tests contained within one worksheet alongside some data, does Rasta require that the data comes first and then the methods to test? If I've got more than one method, then is the leftmost method executed first (in a row-based set of data)?

* how do I go about "disabling" a row of data?

* is Rasta also supported under Linux/Mac?

Thanks.

By: Hugh McGowan
RE: Organizing test fixtures [ reply ]  
2008-10-05 18:48
Hi Robert,

You can definitely reuse the same class. Although Excel doesn't like tabs with the same name we've gotten around that by allowing comments in the tab. So you could have tabs like ContactsScreen#create, ContactsScreen#edit and ContactsScreen#delete and they would all use the ContactsScreen class.

Your example above could roughly translate to a fixture that looks something like this:

require 'rasta/fixture/rasta_fixture'

class ContactsScreen
include Rasta::Fixture::RastaFixture

attr_accessor :name, :title

def before_all
@contacts = IE.new
end

def before_each
@contacts = goto('http://internalsite/')
end

def create_business_manager
<watir code here>
end

def create_finance_manager
<watir code here>
end

def create_it_manager
<watir code here>
end

... etc ...
end

Then your spreadsheet would have any class attributes so for example it could be(left column bolded):
name John Smith
title Linux Administrator
create_it_manager /some text/

Thanks!
Hugh

By: Robert Stagner
RE: Organizing test fixtures [ reply ]  
2008-10-05 16:25
My example RSpec file has a typo in it. I neglected to change all the @login values to @contacts. It should have read as follows

describe ContactsScreen do
before(:all) do
@contacts = IE.new
end

before(:each) do
@contacts = goto('http://internalsite/')
end

it "should create a new business manager" do
@contacts.test_create_business_manager.should include('some text')
end

it "should create a new finance manager" do
@contacts.test_create_finance_manager.should include('some text')
end

it "should create a new IT manager" do
@contacts.test_create_it_manager.should include('some text')
end
.
.
.
.

end


Sorry for any confusion.

By: Robert Stagner
Organizing test fixtures [ reply ]  
2008-10-05 16:21
I've been actively using RSpec/Watir to develop a series of test cases designed to test an in-house web application. I've been very satisfied with the results thus far. My 'framework' is designed such that I have a series of RSpec files that make calls to various instance methods, which in turn, call the Watir scripts I wrote. So, for example, an RSpec file might look like

describe ContactsScreen do
before(:all) do
@contacts = IE.new
end

before(:each) do
@login = goto('http://internalsite/')
end

it "should create a new business manager" do
@login.test_create_business_manager.should include('some text')
end

it "should create a new finance manager" do
@login.test_create_finance_manager.should include('some text')
end

it "should create a new IT manager" do
@login.test_create_it_manager.should include('some text')
end
.
.
.
.

end

I've also created several other RSPec files that work with the same class (ContactsScreen) -- one for editing contacts and one for deleting contacts.


After reviewing the Rasta framework, I am very excited at the possibility that Rasta presents. I plan on downloading a copy first thing on Monday.

Within Rasta, is it possible to create several worksheets labeled ContactsScreen, one for creating contacts, one for editing contacts and one for deleting contacts?? I'd like to maintain the separation of behavior that I've already built in to the various RSpec files I've created. That way, I only maintain one class associated with the contacts screen.