Post navigation

Saving Your Automatic Web Page Test Result

In the previous example, it was shown that we can built functional tests for our web code making sure it comply with the needed functionality or that it continues to work as expected after our modifications.

The next step is to permanently store the result as proof that it was checked properly and that it is ready for acceptance tests from our clients.

Ruby Interface with a Database

In this example the result is stored in RTH database (Requirements and Testing Hub) -an open source system-. We’ll use a file (RTH_Verify.rb) that was posted in the original RTH forum page and unfortunatelly no longer available. There are four steps, first the initialization of the odbc interface, creation of a test suite record and update that a test as beeing run, notification of the completed test and close of the connection.

First Part (RTH_Verify.rb)

[This code is from the original developers of RTH]
In this class they initialize the odbc interface to MySQL rth database in a initialize call.
For your instalation you will have to change: yourserver, rth (or your database), yourdbuser, yourdbpassword.

The Second Part (RTH_Verify.rb)
It’s about setting variables: time, sql INSERT string (you can check the file for the complete syntax), sql UPDATE string for the status record. And excecuting the initial notifications of a test being run.

If it the test terminates normally, the test is successfull, and the database has been modified so the ‘results page’ on the RTH system wi’ll show that an automated test exist and user or QA confirmation is needed to change status to ‘signed’.

You can modify this file for your particular system or try RTH which I recommend.