[Webtest] Executing WebTest Scripts

Paul King webtest@lists.canoo.com
Thu, 06 Apr 2006 06:33:17 +1000


If you were just using straight Ant you could do:

<webtest ...>

<java...> or <junit...>

<webtest...>

And you could use haltonerror/failure settings to
tie the pieces together. You could also use ant,
antcall or macrodef features to encapsulate the
duplicate webtest steps for logging in. You can
mix the Java/JUnit steps within a single webtest
as well but I don't see your need to do that.
You would be better off with new sessions to test
the locked out user part which the above gives you.

I am still a maven novice so I don't know if this
advice carries straight over or not.

Cheers, Paul.

Jan Nielsen wrote:
> Hello! 
> 
> I'm brand new to WebTest. I have written my first WebTest script which 
> performs a login to one of our applications, and I am quite happy with the 
> simplicity of the WebTest XML script - really super for the 
> presentation-layer folks. 
> 
> My next step is to integrate my test into Maven (and it appears there is a 
> plug-in written already); capture how long it took my test to execute; and 
> to log this duration for historical display. I am likely not the only one 
> looking for this - so, any advice on how to proceed with this?
> 
> After the build integration work is complete, I would like to extend the 
> example by performing several application-level reconfiguration steps 
> while the test is executing. Here's an example:
> 
>   Successful Login Test:
>     - login with valid user id and password 
>     - check for success
> 
>   Account Locked Login Test:
>     - <lock the account>
>     - login with valid user id and password
>     - check for account locked failure
> 
> I have Java APIs to perform the <lock the account>. I believe one way to 
> do this is to write a Groovy script which has the appropriate Java code in 
> it. I would prefer to execute the Java code in a JUnit test, and then 
> perform a "call-out" to the WebTest XML script to perform the login. Does 
> that make sense...even in the WebTest world? Or should I be using 
> HttpUnit, or some other tool for this? I like using JUnit tests because 
> our Java developers are already setup to do this, as is the build server, 
> so that's the natural way to these folks to test code. Any thoughts and/or 
> helpful hints?
> 
> Many thanks for any and all input.