Hi there,

I keep "grooving" and "webtest"ing and all I see is pretty fantastic...
I've got a little issue, but can't say where it comes from.

The application I test is an Ajax one which provides City names as soon as a zip code is entered in a field. So I have a setInputField() step (I work with groovy Antbuilder) that reload the form, and due to the magic of webtest (and htmlunit), it provides me a new select field with city names related to the zip code (these are french
zip codes, I don't think they're the same as the US ones).

The problem is that the names of the cities could be slightly differents from those I expect. Example :
Albon
Andancette
Anneyron
Saint Rambert d'Albon

when I expect SAINT-RAMBERT-D-ALBON (that's just an example, I've nothing to do with this city or its well-known toll barrier on the A6)

The String I expect is very "close" to the one of the select, but is not exactly the same, so setSelectField(text:"SAINT-RAMBERT-D-ALBON")
will fail.
So i've made a groovy() step that sorts the option values thanks to the levenstein distance for strings (I think it could be a great feature in Webtest if we can do <setSelectField levenstein:"string_to_refer_to">, but I'm aware that 'd cause many changes)
The script is something like below :
*import org.apache.commmons.lang.StringUtils

def props = step.webtestProperties
def document = step.context.currentResponse.documentElement*
.........

It works fine when running standalone, but inside webtest, it tells me something like that : *ERROR (com.canoo.webtest.extension.groovy.GroovyInvoker) - CompilationFailedException org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script1.groovy: 1: unable to resolve class org.apache.commmons.lang.StringUtils
@ line 1, column 1.
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:326) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:848)

*Has anyone ever tried to import a package in a groovy step ?
(Note org.apache.commons.lang.StringUtils is in webtest's classpath)

Thanks for your help

Florent

--
Pingwy
27, rue des arènes
49100 Angers

Reply via email to