Hi,
I got it now somehow working. Copied this groovyscript to test file before
target that executes tests.
<groovyScript>
class MyProperty extends org.apache.tools.ant.taskdefs.Property
{
String encoding
protected void loadFile(File file)
{
def text = file.getText(encoding)
def lines = text.split("[\\n\\r]*")
lines.each {
if (!it.startsWith("#")) {
def pos = it.indexOf("=")
if (pos > 0)
{
addProperty(it[0..pos], it[(pos+1)..-1])
}
}
}
}
}
project.addTaskDefinition "myProperty", MyProperty
</groovyScript>
And defined
<myProperty file="conf/utf-8.txt" encoding="UTF-8"/>
It seems that it works to some extent but not completely. When I made mistake
in file name, then ant gave error.
And when commented out groovy script, then ant complained about not knowing
myProperty.
But when I use some property value from that file, then this is not resolved.
In property file I used same format like in other property files:
poperty <tab> value
Maybe there is some mistake in script? Maybe I used wrong format in property
file?
Debug mode didn't show anything useful, only thing I saw about myProperty was:
Trying to override old definition of task myProperty
Mart
Marc Guillemot wrote:
why can you only use it inside webtest <steps>? Normally you can use it
at any place once groovyScript is defined.
You say that the property was not resolved. Does it means that nothing
is loaded by the custom step? Can you add debug output to it?
Cheers,
Marc.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest