Run Script


On this site we use a simple script to run all of the examples. The script is a feature of this site, not the framework, but it works so well we have to show it off too. Here we explain how the script works. You can see the script in use in the ExampleTests.


Consider this simple test of addition.

eg.ArithmeticColumnFixture
x y plus()
2 3 5

Click the following link (the run script) to retrieve this page processed by the framework.


How This Works

When you run this example your browser retrieves the page twice: once from the wiki server and then again from the run script. The run script answers the page with the test results marked in pastel red or green. To do this the run script must do two things. It must ...

  • get a copy of the original page for itself
  • check the values in the copy to produce the test results

Its easy for the run script to get a copy of the page. It goes to the same server you go to. It knows how to find this server because your browser passes its url along to the run script as the "refering web page", the so called HTTP-REFERER.

We use a unix utility program to retrieve the private copy of the refering web page. There are probably lots of utilities like this but the ones we know about are the following.

Once the run script has a copy of the tests it runs them just like you would at the command line. (See RunMeFirst.) The run script uses the WikiRunner variation of the FileRunner so that the extra tables wiki uses for page layout aren't confused with test data tables inside that layout.

The run script creates two files, one is a temp file that holds the results until the runner completes. This is then sent back to your browser so you see the results right on top of the original page. The second file is a transcript of the error output from the run. Normally this is just a report of things the framework counts:

   76 right, 12 wrong, 0 ignored, 0 exceptions

We log the error output so that you can see this message. Its also handy for us to track down problems when we get our server misconfigured. You can look at the most recently recorded long with this link.

This may not be the log from your last run if there are lots of people using our server. The SummaryFixture will report these same counts right in the html output so you don't have to worry about saving the error log.

fit.Summary

This link will let you see the source for the run script we are using right now on fit.c2.com. There are a handful of other lines we had to write to get this to work in our server environment, but most of the work is done in two lines that correspond to the two steps we mentioned above.

We encourage you to set up a server on your own computer and write some sort of run script for the tests you will be using while programming. We develope fit using a clone of the fit site on our laptop. We've configured our development environment to store compiled code straight into our cloned website.


More Ideas

We could have taught our runner to retrieve the page directly but didn't think of that until the run script was already written.


SimonMichael is working on a similar runner over at http://zwiki.org/FitTests.

MikeLeach has the start of a DotNetRunScript.

MichaelNestler wrote this PerlRunScript.


I run this script on my Apple iBook. This required two adjustments. First, I modified the /etc/httpd/httpd.conf so that Apache would run the script. Here is the diff:

 397c397
 <     Options Indexes FollowSymLinks MultiViews
 ---
 >     Options Indexes FollowSymLinks MultiViews ExecCGI
 865c866
 <     #AddHandler cgi-script .cgi
 ---
 >     AddHandler cgi-script .cgi

Second, I also had to make sure that the server (which ran the script) had permission to access all the files cited by the script. I did this by actually putting all the files in a server subdirectory and using symbolic links to coax my IDEs (IntelliJ and Eclipse) to write class files there.


For the ObjectiveCeePlatform, the run script for Apache on my iBook is just slightly different from the Java runscript.

   curl $HTTP_REFERER >Documents/$$ # calls curl instead of lynx
   FileRunner Documents/$$ Reports/$$ # runs the ObjC file runner

 

Last edited December 14, 2003
Return to WelcomeVisitors