final String webtestVersion = PackageBoundary.versionMessage();
LOG.info(webtestVersion);
getProject().setProperty("webtest.version", webtestVersion);
assertParametersNotNull();
final Context context = new Context(this);
CONTEXT_HOLDER.set(context);
LOG.debug("Executing configuration task");
getConfig().setContext(context);
getConfig().perform();
// register custom property helper in place of the original one
final PropertyHelper originalPropertyHelper = PropertyHelper.getPropertyHelper(getProject());
WebtestPropertyHelper.configureWebtestPropertyHelper(getProject());
// register the listener that will capture the results
fResultBuilderListener = getWebtestCustomizer().createExecutionListener(this);
getProject().addBuildListener(fResultBuilderListener);
try {
executeSteps();
}
catch (final BuildException e) {
// nothing, exception is available in result build listener too
}
finally {
fResultBuilderListener.webtestFinished();
getProject().removeBuildListener(fResultBuilderListener);
WebtestPropertyHelper.definePropertyHelper(getProject(), originalPropertyHelper);
// clean the WebClient(s) to stop running js scripts (like setTimeout)
for (final Iterator iter=context.getWebClientContexts().values().iterator(); iter.hasNext();)
{
final WebClientContext webClientContext = (WebClientContext) iter.next();
webClientContext.destroy();
}
}