Login | Register
My pages Projects Community openCollabNet

Discussions > dev > [maxq-dev] hello, world!

Discussion topic

Back to topic list

[maxq-dev] hello, world!

Author rkrzewsk
Full name Rafał Krzewski
Date 2005-03-08 02:09:06 PST
Message Hello everyone,

I'm new to the list and to MaxQ itself, please let me introduce myself.
My name is Rafal Krzewski, I'm located in Warsaw, Poland. I work in a
small software developeent company Caltha Sp.J. (no sensible website at
this time, sorry) I've taken part in several OpenSource projects to
date, most notably Jakarta Turbine project, back in 2000/2001. Some bits
of my code writtent at that ended up in Jakarta Commons FileUpload and
Lang projects. Later I've co-developed a web application framework
similar to Turbine but, sadly, it went below the waves because of IPR
dispute. In an effort to save the bits that were free of IPR claims
ObjectLedge (http://objectledge.org) project was created. Apart from web
application frameworks I've been working on CMSes. My company developed
major portal for Polish non-governmental organizations (http://ngo.pl)
70k pages to date, 5M hits/month volume.

I am intersted in MaxQ because we need to develop a suite of end-to-end
regression tests for our portal application in preparation to a large
scale refactoring. We are seeking for ways of automating it as much as

Our plan at this point is using MaxQ for rapid generation of test
skeletons, but not running the tests themselves. We are experienced Java
programmers, but we don't know Python (except knowing that it's cool).
Learning another language just to write the tests does not seem
economically justifiable. Moveover we want to use JUnit test runners in
Maven & Eclipse to run the tests (+generate reports). As far as I can
tell it is not possible with the Python tests generated by MaxQ.

I spent some time examining the .generator package and looking for ways
we can adapt it to our needs - the JavaCodeGenerator was abandoned for
some time and it was not following the same contract as the other
generators. I tried writing JavaCodeGenerator2 based on
AbstractCodeGenerator along the lines of CompactGenerator contract, but
I found AbstractCodeGenerator to be more limiting than helpful.

I came up with an another approach that seems very natural to me - I
develop web applications and I have Turbine background - using Velocity
templating rendering engine for code generation. I wrote a
TemplateCodeGenerator starting from IScriptGenerator interface and
moving code from AbstractCodeGenerator as necessary and I ended up with
code that can support the existing usage scenarios but is IMO clearer
and more compact. A big advantage of this approach is easy customization
of the generated tests by the end user: put a copy of the templates from
the distribution on the classpath, edit them as neccessary and you're
ready to roll - no recompilation of MaxQ is necessary!

After accomplishing the first goal (code generation driven by templates)
I went on to generating the skeletons. I want them be based on HttpUnit
or even better on jWebUnit. To make the them sensible, the generator has
to determine (guess if you please) which link / submit button on the
page _n-1_ was used to initiate request _n_. For that, the pages need to
be parsed into a logical structure that can be navigated easily.
HttpUnit provides all the necessary tools, but I had to use a little
persuasion (read patching) to make it process the content intercepted by
MaxQ proxy. At this point my generator is able to pick out links on the
basis of next request's urls and HTML forms on the basis of parameters
found in the next POST request. More is possible though - like picking
out submit buttons, or 'javascript:send()' submits. I might be working
on these if they prove necessary during creation of my test suite
mentioned above.

I am willing to contribute the code described here to the MaxQ project
if the community is interested. If not - I'm fine with that, it will
become a part of http://objectledge.o​rg/module/ledge-web subproject.
Note that my contribution does not require any modification of the
existing MaxQ codebase - I've duplicated some bits of MaxQ that I wanted
to reuse / customize. In the future templates for generating Python
tests could be developed (it's very easy) and all IScriptGenerator
implementations except the TemplateCodeGenerator could be removed - but
it's an optional step.


To unsubscribe, e-mail: dev-unsubscribe at maxq dot tigris dot org
For additional commands, e-mail: dev-help at maxq dot tigris dot org

« Previous message in topic | 1 of 8 | Next message in topic »


Show all messages in topic

[maxq-dev] hello, world! rkrzewsk Rafał Krzewski 2005-03-08 02:09:06 PST
     Re: [maxq-dev] hello, world! fcohen Frank Cohen 2005-03-08 07:36:03 PST
         Re: [maxq-dev] hello, world! rkrzewsk Rafał Krzewski 2005-03-09 00:56:27 PST
             Re: [maxq-dev] hello, world! fcohen Frank Cohen 2005-03-09 20:55:32 PST
     Re: [maxq-dev] hello, world! jer_57 Jerry 2005-03-09 04:58:33 PST
         Re: [maxq-dev] hello, world! rkrzewsk Rafał Krzewski 2005-03-09 05:11:55 PST
             Re: [maxq-dev] hello, world! rkrzewsk Rafał Krzewski 2005-03-09 05:17:32 PST
             Re[2]: [maxq-dev] hello, world! jer_57 Jerry 2005-03-09 05:34:38 PST
Messages per page: