Working with WebTests (Help?)

Well, I wish I could say that this was going to be a guide to getting WebTests (an automated front-end testing tool that sits on top of Ant) but it seems as though I’m having a bit of a Java issue to content with myself.

Here’s what I’ve done so far:

  • First, I noted happily that Ant was already installed on my MacBook’s OS X install (seems a strange choice to have bundled, but who am I to judge), making for one less thing that I’d have to get up and running
  • Next I grabbed the latest install of WebTest from the Canoo website and unpacked it to a testing directory. It comes as a nice, neat binary so there’s no messy compiling to worry about.
  • I wrote up a simple test and PHP page to try it all out:
    <project name="mytest" basedir="." default="test">
            <target name="test">
                    <webtest name="My Test">
    <project name="mytest" basedir="." default="wt.full">
            <property name="webtest.home" location="/dev_tmp/webtest" />
            <import file="${webtest.home}/webtest.xml"/>
            <target name="wt.testInWork">
                    <webtest name="My Test">
                            <invoke url="http://dev.localhost/index.php" description="login page" />
                            <setinputfield name="user" value="testuser" />
                            <setinputfield name="pass" value="testpass" />
                            <clickbutton name="sub" />
                            <verifytitle description="post-login submit" text="subme!" />
                    </webtest>
            </target>
    </project>
    
  • Finally, I gave it all a whirl: “bin/webtest -buildfile /my/path/mybuild.xml

This is where I hit the first snag…apparently since OS X’s Java install is just a bit different than some of the normal ones, a few of the files aren’t where they need to be. In my case, I was getting an error:

BUILD FAILED
/www/tests/mytest.xml:5: 
java.lang.NoSuchMethodError: 
org.apache.xpath.compiler.FunctionTable.installFunction
(Ljava/lang/String;Ljava/lang/Class;)I

After poking around a bit on the web, I happily came across this that recommends copying a jar file over to the Java extensions directory. A simple “cp” later and the build made it past that point. Unfortunately, not much past it, though – another Java error popped up that seems a bit more difficult to find information on:

BUILD FAILED
/dev_tmp/webtest/webtest.xml:265: 
java.lang.NoClassDefFoundError: 
org/apache/xml/serializer/ExtendedContentHandler

So far I haven’t been able to find much that’d help me solve this one, so if there’s anyone out there that’s seen it before, help would be appreciated. It seems like it actually runs the test just fine (according to the output reports) but it’s not very useful if the build always fails.

Category: Deployment, Development, Testing 2 comments »

2 Responses to “Working with WebTests (Help?)”

  1. Lori

    Have you resolved this issue? My WebTest was working fine until I upgraded to SnowLeopard. Now I am getting this error, after doing the Xalan.jar copy. I came across this post while looking for the resolution.

  2. Lori

    Just a note that I found the resolution was to copy over the serializer.jar to Extensions dir as well (same as with the Xalan.jar).


Leave a Reply



Back to top