[Webtest] examples of tests in groovy

Murat Murat <murat.knecht@googlemail.com>
Tue, 25 Oct 2011 11:41:46 +0200


Hi!

1. In our groovy / xml Canoo-Test, we're using the following snippet
to configure and run tests. You'll notice that the structure is
identical to the XML-based tests.

		ant.testSpec(name:"${testInstance.class.simpleName}") {
			config(default_config)
			steps() {
				testInstance.invokeMethod(method.name, null)
			}
		}

default_config is a Map with the respective entries, host, protocol, ...

2. Entities: No idea. We don't use them anymore, as they don't scale well.
Macros: Use the AntBuilder to import the definitions file which in
turn imports the definitions files:

		ant.import (file: absolutePath("${getPathToCanooDir()}/definitions.xml"))

You can then use the macro definitions in your tests.

Regards,
Murat