-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I may just be in line to write one of these "cool, simple to use, end
user applications" (after i'm happier with my ruby expertise). My
problem is coming up with one to write
Does anyone have a list of ideas?
Here's something I've just started on, but may not ever get around to finishing.
I've been using WATIR[0] to test a client's Web app. I've been trying
to structure things so that a non-Rubyist can a least run tests with
no problem, and that a newbie Rubyist can alter or rearrange existing
code to assemble test suites. And of course a more experienced coder
can just go have fun.
I have written a small number of methods that test very specific
things, such as logging in, moving to a given page, adding a new user
to the system. In general one test depends on the out com of another.
I wanted some sort of DSL-like syntax to convey this dependency while
not cluttering things up with scads of if/then/else.
Each test method is at the Object level, and each method ends by
making an assertion, and evaluating a given block if the assertion
passes.
So you can write test scripts like this:
: log_in( user, psw) {
: go_to_add_user_page {
: add_new_user( user_name, pass, user_id, group ) {
: delete_user( user_id )
: }
: }
: }
I thought it would be nice if there was a way to allow such test
assembling using a GUI.
It is quite simple to have an instance of WEBrick run, start the
default browser, and load the testing start page. The main page could
list all available test scripts. At the simplest level the user could
just click on a test name to run it.
At a more complex level, the user could select a sequence of tests to
run; the code would need to verify that the sequence made sense.
possibly by only showing valid choices after each test is selected.
(Perhaps something that could be nicely handled using JavaScript and
the XMlHttpRequest object talking back to the WEBrick instance to
calculate the options by inspecting the test code. I was thinking that
Rdoc::Usage might be handy here.)
Tests could be run. Results could be stored in a database, using
Sqlite3. Users could run queries to see what tests were run, when,
and with what results.
It would be nice if one could schedule tests to run at a later time, too.
All this of course is Win32 only (that's a requirement of WATIR), but
that targets a sizable audience.
My goal is/was to get something fairly simple but useful in place
fast, packaged up using exerb so that there are no pre-installation
requirements. It Just Works! There's No Step Two (chortle!)(tm)
Just deliver a stand-alone executable that allows people to write and
run Web app test code with a nice GUI. The recent work on WATIR and
Sqlite3 bindings makes this really quite doable. (And Ruby Web Forms
might be handy as well.)
So far all I have is a basic WEBrick instance that reads in a list of
test script files from a pre-defined directory and renders a web page,
with each script a link.
Clicking on a test name tells WEBrick to go shell out and run the test
script. The results of the test are then rendered to the Web page.
It's somewhat crude, but sort of slick, too, because it took about 1/2
hour and It Just Works.
James Britt
PS, anyone doing Web work on Win32 really should go look at WATIR.
Very well done.
[0]
http://wtr.rubyforge.org/