Overview

Rasta is a keyword-driven test framework using spreadsheets to drive testing.
It’s loosely based on FIT, where data tables define parmeters and expected
results. The spreadsheet can then be parsed using your test fixtures.

For the underlying test harness, Rasta uses RSpec so in addition to reporting
results back to the spreadsheet you can take advantage of RSpec’s output
formatters and simultaneously export into other formats such as HTML and plain
text.

You create the test fixture

The test fixture is a class that you define to interface between rasta and the
application under test. Since you know the most about your application, this
only makes sense and gives you the ability to do anything you like in your test;
check a database value, run a watir script or perform a few simple math
functions. All we’re looking for is that our test fixture has attributes that
allow us to set input variables and methods that we can call and compare the
results with expected values. Let’s say we have something like this class:

require 'rasta/fixture/rasta_fixture'
class MathFunctions
  include Rasta::Fixture::RastaFixture
  attr_accessor :x, :y
  def add
    x+y
  end
  def subtract
    x-y
  end
  def multiply
    x*y
  end
end

Including the Rasta fixture is all we need to do to hook into the spreadsheet.

Spreadsheets define the tests

Spreadsheets are used to both define the test input paramters and expected
results. A sample spreadsheet for this fixture can be seen in Figure 1. You
cannot see it in the figure, but the name of the worksheet is ‘MathFunctions’.
This helps the rasta script find the right test fixture to use.

You can have any number of worksheets in your spreadsheet and run tests against
one or more test fixtures. As your tests run, the cells are colored green and
red to indicate pass/fail. For test failures, the cell is commented with the
details of that failure.

Also, since we’re using spreadsheets we can take advantage of a lot of the
functionality that exists. Dropdowns can be added to restrict input to a list
of values or you can use named variables or calculated values . For example,
you could easily have one of the cells show today’s date using Excel’s TODAY()
function.

Further, the rasta script provides workflow control allowing you to start your
script where it last left off, start from a specific tab, run ‘n’ pages, etc.

Tests are run from the commandline

From a commandline you specify both the spreadsheet and the directory tree that
contains the test fixture class files (you’ll need to download the example zip).

rasta examples\rasta_fixture.xls -f examples\fixtures


While the script is running, progress is reported on the commandline as shown
in Figure 4. Test results can later be reviewed in the spreadsheet or the html
output. All test output is placed in a directory called ‘rasta_test_results’.

Figure 1: Spreadsheet before test run

Figure 2: Spreadsheet after test run with results

Figure 3: Failure notes are added as a cell comments

Figure 4: Progress is reported on the commandline

Figure 5: Results are also exported to HTML