cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <j...@socialchange.net.au>
Subject Re: testing/performance framework for Cocoon
Date Sun, 23 Sep 2001 23:43:34 GMT
On Sun, Sep 23, 2001 at 12:34:34PM -0700, Ovidiu Predescu wrote:
> Jeff,

[large snip]
 
> > Here's a sample XML file, doing a few tests against XML services:
> > 
> > <?xml version="1.0" standalone="no"?>
> > <!DOCTYPE suite SYSTEM "../conf/suite.dtd">
> > <suite defaultHost="newgate.socialchange.net.au" label="newgate">
> > 
> >     <request path="/sightings/servlet/WFSSightingsServlet" label="WFSSightings">
> >         <validate>
> >             <statusCode label="valid HTTP status code"  code="200"/>
> >             <mimeType label="Correct XML MIME type" value="text/xml"/>
> >         </validate>
> >     </request>
> > 
> >     <request host="clearinghouse1.fgdc.gov"
> >         path="/scripts/ogc/ms.pl?WMTVER=1.0&amp;request=CAPABILITIES"
> >         label="SCO WMS">
> >         <validate>
> >             <mimeType value="text/xml"/>
> >             <xmlValidator/>
> >         </validate>
> >     </request>
> > </suite>

> This is part of the functionality I'm looking for. I also need some
> rudimentary support for defining variables, so that values extracted
> from one response document can be used later in the test. Ant
> properties seem to do a good job of this.

How could you do that in Ant?

In Latka, you can set properties, and refer to them with ${..} notation,
but I don't think you can define new vars during a test.

Httpunit definitely could, since it's plain Java.

> > Note that it doesn't use Ant. I suspect this is actually a good
> > thing. Ant 1.x is not flexible enough to be easily repurposed as a
> > http testing engine. This will apparently be fixed in Ant 2, which
> > will be a generic "task execution engine", but for now, it's
> > probably harder to turn Ant into something it's not, than to start
> > again. For instance, there have been *many* submissions of an
> > iterate, or <foreach> task:
> 
> As I looked at Ant, it appears to me the internal architecture is well
> designed and could support the testing framework I think of. The only
> problem I see is the usage of SAX1 API, which precludes one from using
> XML namespaces. I think this problem can be fixed though, by doing the
> appropriate changes within Ant, the code is very well localized. Other
> than this issue, I don't see any reason why Ant would not be a good
> framework to support this testing framework.
> 
> Would you please elaborate on your reasons why Ant's engine would not
> provide a good testing framework?

Grumble.. no-one's free to make wild unsubstantiated claims these
days.. ;) It rather depends on how far you want to go with the
"scripting" side of things. Eg, it is not possible to reassign variables
in Ant, so the following might not be possible:

<iterate name="i" start="0" end="100" increment="1">
    <spawn threads="${i}">
      <url-post href="${url}/test/echo"
         content="contents/sample.xml"/>
      </spawn>
</iterate>

Other than that, I have no specific reasons why Ant couldn't be used,
only a general warning that this is not ordinary Ant usage. Ant was
designed to be a declarative build tool. The ant-dev people have
resisted all attempts to turn Ant into a procedural XML scripting
language. This shows up in various ways, like the non-reassignable
variables, lack of boolean evaluation, and almost no function calling
(<antcall> is very frowned upon).

However, if it can all be done in extension tasks, great :)

> > That thought leads to one serious suggestion: how about implementing
> > the tests in Python, and then using a Python-to-Java compiler
> > (http://jython.sourceforge.net/) to generate bytecode?
> 
> I have done some extensive Python programming in the past, although
> not much JPython. I'm not looking at a full programming language to
> implement this framework. If we go on this path, why not use Java
> directly, why use yet another language the developers/testers need to
> learn?

I agree..

Actually, one could always use Python in a <script>, if it comes to
that.

[..] 
> I believe that no matter what route we go, we should not exclude other
> options from being used. If somebody feels httpunit is the framework
> to use to test a particular feature, it should be possible to use it.

Okay, you've convinced me ;) If you use Ant, it would be simple to
include Bernhard Huber's httpunit tests in a <junit> task.

For the <iterate>, you might want to use one of the many contributed
(and rejected) on ant-dev. There have been other useful
submitted-and-rejected tasks like that. If needed, I can contribute some
basic tasks (online, mimetype, well formed XML, valid XML).

--Jeff


> Regards,
> -- 
> Ovidiu Predescu <ovidiu@cup.hp.com>
> http://orion.nsr.hp.com/ (inside HP's firewall only)
> http://sourceforge.net/users/ovidiu/ (my SourceForge page)
> http://www.geocities.com/SiliconValley/Monitor/7464/ (GNU, Emacs, other stuff)

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message