Ron Jeffries wrote:
On Tuesday, April 25, 2006, at 5:53:51 AM, Steve Loughran wrote:

What's known "out there" about how to test and regression test an
Ant script?

the purpose of a sequence of tasks is to move a build from one state
"clean" to another "ready-to-ship" or "deployed". All you need is assertions in the build to verify that the final state meets the criteria you desire.

Hmm ... so for my site's script, I could, if the assertions were
strong enough, assert (for all x, x.html is newer than x.xml), plus
similarly for some named files (index.html newer than *.xml except
bookindex.xml).

That would be handy ... in fact it would be handy if Ant just let me
assert the end state and did the job. ;->

I dont disagree, since that is effectively what the latest generation of configuration management tools do. The hard part is determining which actions to take to get a machine into the state you want from its current state, which rapidly approaches ai-hard problems for high level descriptions, but is more tractable for low level descriptors. The other problem is that developers and sysadmins often operate in a procedural mode.

Example, one way of creating a temp dir is to have a smartfrog sequence to create a dir

actions extends Sequence {
 mkdir extends Mkdir {
   parent "/tmp";
   subdir "server"
  }

  WebServer extends Tomcat {
   rootDir  "/tmp/server";
 }

 rmdir extends Rmdir {
   dir  "/tmp/server";
}

The more intersting way is to have a TempDir component that not only makes up a name for itself as it goes along, it deletes itself on shutdown

tempdir extends TempDir {
        deleteOnExit true;
 }

And its dynamically generated filename is fed in to the app server:

WebServer extends Tomcat {
 rootDir  LAZY tempdir:absolutePath;
}

Its a different model of the word. One has a workflow of actions, one describes the state of a valid configuration "there is a temp dir, there is a web server bound to the temp dir".




If you check out Ant from SVN, there is an antunit antlib that provides
a set of assertions for testing things. I'll cover it the forthcoming
2nd edition of Java Development with Ant, albeit in the context of testing tasks you write yourself.

I'll watch for the assertions to become part of the release, and for
the book. As I'm just using Ant for this one task in my life,
creating my web site, I may choose not to go down the SVN path.

ahh, go on, use a <get> or two just to check state :)



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to