import java.lang.reflect.Method class MyWebTest extends grails.util.WebTest { def log = LogFactory.getLog(this.class) void suite() { this.class.getMethods().each {Method method -> def methodName = method.name if (methodName.startsWith('test') && shouldRunTest(methodName, this.class.name)) { try { method.invoke(this, null) } catch (e) { LogFactory.getLog(this.class).error('Unable to invoke test method ' + method.name, e) throw e; } } } } boolean shouldRunTest(testName, className) { def testPattern = System.getProperty('webtest.test.run.pattern') if (testPattern && !(testName =~ testPattern)) { log.debug("Running ${className}.$testName as it does not match the test pattern: $testPattern") return false; } def classPattern = System.getProperty('webtest.class.run.pattern') if (classPattern && !(className =~ classPattern)) { log.debug("Running ${className}.$testName as it does not match the class pattern: $classPattern") return false; } return true; } }