You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ovidiu Predescu <ov...@cup.hp.com> on 2002/04/05 04:14:11 UTC

Cocoon functional testing using Anteater

I've finally decided to take time to implement functional testing in
Cocoon using Anteater, a tool Jeff Turner and I worked on since the
end of last year.

Using Anteater you can write regression tests against a deployed
Cocoon application. You can fire HTTP requests, and check for various
things in the response, using regular expressions, XPath and other
things. Anteater is more powerful than this, it can also act as the
server side, allowing you to test the client side of your application.

For now the integration is done specifically for Schecoon, but it
should be trivial to adapt to the normal Cocoon. To run the tests you
simply type in the schecoon/ directory:

./build.sh test

This spawns off Anteater on the tests/anteater/all-tests.xml file. The
default task in this file will search for test files located in
tests/anteater and will run them automatically.

To write a test you create a "normal" Ant file, which will actually
contain Anteater extended tasks. The file should contain only one
target, whose name is the same as the file's name, except for the .xml
suffix. This target will be automatically picked up by the
all-tests.xml file and executed. Checkout the calc.xml test for an
example:

http://cvs.apache.org/viewcvs.cgi/xml-cocoon2/src/scratchpad/schecoon/tests/anteater/calc.xml?rev=1.3&content-type=text/vnd.viewcvs-markup

This file tests the Calculator example written using the brand new
control flow layer in Schecoon.

To run the sample, you first need to install Anteater from

http://sourceforge.net/projects/aft/

At this point, the Anteater documentation is very crude, and there's
no Web page, besides the Sourceforge project one. If you know Ant it
should be fairly easy to learn the new commands introduced by
Anteater.

Please let me know if you're interested in getting more info on
Schecoon or Anteater.

Have fun,
-- 
Ovidiu Predescu <ov...@cup.hp.com>
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


Re: Cocoon functional testing using Anteater

Posted by Ivelin Ivanov <iv...@iname.com>.
Super Extra Cocool !

Have you considered integration with Jakarta's Latka?
http://jakarta.apache.org/commons/latka/index.html


Please put on the wish list a features:

1) allowing for POST of text/xml mime content. This will allow testing web
services.
2) Allowing for match of XML content. This will help with WS (related to 1)
and testing against "content" views of a web site.


A quick and dirty example:

<project name="calc-test" default="calc">

  <target name="calc">
    <http description="Test the 'calc' JavaScript implementation">
      <httpRequest href="${schecoon}/calc/${cont1}" mime="text/xml">
        <post>
            <?xml version="1.0" encoding="utf-8"?>
            <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
            <soap:Body>
            <GetTopIdeas
xmlns="http://www.soapengine.com/lucin/salcentral/cidea.asmx">
                <UserID>long</UserID>
                <Password>string</Password>
                <HTMLFormat>boolean</HTMLFormat>
            </GetTopIdeas>
          </soap:Body>
          </soap:Envelope>
        </post>
        <match>
          <xpath
select="envelope/body/getTopIdeasResponse/GetTopIdeasResult"
assign="result">
            <value>
                <Item
xmlns="http://www.soapengine.com/lucin/salcentral/cidea.asmx">
                  <IdeaID>6</r:IdeaID>
                  <IdeaName>Global Positioning</IdeaName>
                  <YesVote>0</YesVote>
                  <NoVote>0</NoVote>
              </Item>
            </value>
          </xpath>
        </match>
      </httpRequest>




Do you think this will make it in CVS before 2010 ;-) ?


Great Job !

Ivelin


----- Original Message -----
From: "Ovidiu Predescu" <ov...@cup.hp.com>
To: <co...@xml.apache.org>
Sent: Thursday, April 04, 2002 8:14 PM
Subject: Cocoon functional testing using Anteater


> I've finally decided to take time to implement functional testing in
> Cocoon using Anteater, a tool Jeff Turner and I worked on since the
> end of last year.
>
> Using Anteater you can write regression tests against a deployed
> Cocoon application. You can fire HTTP requests, and check for various
> things in the response, using regular expressions, XPath and other
> things. Anteater is more powerful than this, it can also act as the
> server side, allowing you to test the client side of your application.
>
> For now the integration is done specifically for Schecoon, but it
> should be trivial to adapt to the normal Cocoon. To run the tests you
> simply type in the schecoon/ directory:
>
> ./build.sh test
>
> This spawns off Anteater on the tests/anteater/all-tests.xml file. The
> default task in this file will search for test files located in
> tests/anteater and will run them automatically.
>
> To write a test you create a "normal" Ant file, which will actually
> contain Anteater extended tasks. The file should contain only one
> target, whose name is the same as the file's name, except for the .xml
> suffix. This target will be automatically picked up by the
> all-tests.xml file and executed. Checkout the calc.xml test for an
> example:
>
>
http://cvs.apache.org/viewcvs.cgi/xml-cocoon2/src/scratchpad/schecoon/tests/
anteater/calc.xml?rev=1.3&content-type=text/vnd.viewcvs-markup
>
> This file tests the Calculator example written using the brand new
> control flow layer in Schecoon.
>
> To run the sample, you first need to install Anteater from
>
> http://sourceforge.net/projects/aft/
>
> At this point, the Anteater documentation is very crude, and there's
> no Web page, besides the Sourceforge project one. If you know Ant it
> should be fairly easy to learn the new commands introduced by
> Anteater.
>
> Please let me know if you're interested in getting more info on
> Schecoon or Anteater.
>
> Have fun,
> --
> Ovidiu Predescu <ov...@cup.hp.com>
> 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
>


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


Re: Cocoon functional testing using Anteater

Posted by Rob Jellinghaus <ro...@unrealities.com>.
For the Axis project (xml.apache.org/axis), last summer, I implemented the 
functional-tests Ant target.  This target:

1) launched an HTTP server running Axis
2) ran several client tests against it (deploying web services, using them, 
verifying the results, undeploying)
3) closed the HTTP server

This became part of the GUMP process for Axis, leading to a system where 
one command line ("build clean functional-tests") would do a full rebuild 
of the source tree and then run multiple client-server tests.

Would Anteater be usable in this kind of a configuration, where a parent 
Ant task spawns a server (presumably an Anteater server), runs various 
client tests against it, and then sends that server a message shutting it down?

If so, I think it would be VERY useful to implement this kind of testing 
for Cocoon.  Among other things, it could have caught the 
AbstractValidatorAction bug that crept into 2.0.2!

Automated functional tests are your friend....
Cheers,
Rob


At 06:14 PM 4/4/2002 -0800, Ovidiu Predescu wrote:
>I've finally decided to take time to implement functional testing in
>Cocoon using Anteater, a tool Jeff Turner and I worked on since the
>end of last year.
>
>Using Anteater you can write regression tests against a deployed
>Cocoon application. You can fire HTTP requests, and check for various
>things in the response, using regular expressions, XPath and other
>things. Anteater is more powerful than this, it can also act as the
>server side, allowing you to test the client side of your application.
>
>For now the integration is done specifically for Schecoon, but it
>should be trivial to adapt to the normal Cocoon. To run the tests you
>simply type in the schecoon/ directory:
>
>./build.sh test
>
>This spawns off Anteater on the tests/anteater/all-tests.xml file. The
>default task in this file will search for test files located in
>tests/anteater and will run them automatically.
>
>To write a test you create a "normal" Ant file, which will actually
>contain Anteater extended tasks. The file should contain only one
>target, whose name is the same as the file's name, except for the .xml
>suffix. This target will be automatically picked up by the
>all-tests.xml file and executed. Checkout the calc.xml test for an
>example:
>
>http://cvs.apache.org/viewcvs.cgi/xml-cocoon2/src/scratchpad/schecoon/tests/anteater/calc.xml?rev=1.3&content-type=text/vnd.viewcvs-markup
>
>This file tests the Calculator example written using the brand new
>control flow layer in Schecoon.
>
>To run the sample, you first need to install Anteater from
>
>http://sourceforge.net/projects/aft/
>
>At this point, the Anteater documentation is very crude, and there's
>no Web page, besides the Sourceforge project one. If you know Ant it
>should be fairly easy to learn the new commands introduced by
>Anteater.
>
>Please let me know if you're interested in getting more info on
>Schecoon or Anteater.
>
>Have fun,
>--
>Ovidiu Predescu <ov...@cup.hp.com>
>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



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