Hi Martin,
Not sure if this helps but here is a little Groovy script you
can run in the groovyConsole which collates tests marked with
a given TestId annotation. I used groovy 1.7 snapshot but it
should run fine with 1.6. This isn't hooked up to webtest at
all yet but I thought might get you started. I don't have time
right now to hook it up to WebTest but I might give it a go
at a later date if I get time. How are you running your tests?
Cheers, Paul.
----------->8------------
import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import java.lang.annotation.Target
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface TestId {
String[] value()
}
public class ExampleTest { //extends WebtestCase {
@TestId (["TC/0002/99/001"])
void test1() {
webtest("TC/0002/99/001 Example test 1") {}
}
@TestId (["TC/0002/99/001"])
void test2() {
webtest("TC/0002/99/001 Example test 2") {}
}
@TestId (["TC/0002/99/002"])
void test3() {
webtest("TC/0002/99/002 Example test 3") {}
}
}
def mapping = [:]
ExampleTest.methods.findAll{ it.getAnnotation(TestId) }.each { method ->
def name = method.name
def id = method.getAnnotation(TestId).value()[0]
def orig = mapping[id] ?: []
orig += name
mapping[id] = orig
}
println mapping
// => [TC/0002/99/001:[test1, test2], TC/0002/99/002:[test3]]
----------->8------------
Flower, Martin wrote:
Hi Marc - thank you for your encouragement, but I do not have the
knowledge to change that groovy script. I am happy to test out
suggestions from the list. Thanks. Martin.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Marc Guillemot
Sent: 19 February 2009 14:14
To: [email protected]
Subject: Re: [Webtest] Marker annotations in groovy test classes not in
bytecode
Why? You probably just need to change the way the groovy tests are
executed, overwriting the wt.groovyTests target. If this shows a better
solution than the current one, I'm ready to integrate it as standard.
Cheers,
Marc.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest