org.codehaus.groovy.grails.test
Class GrailsTestSuite

java.lang.Object
  extended by junit.framework.TestSuite
      extended by org.codehaus.groovy.grails.test.GrailsTestSuite
All Implemented Interfaces:
junit.framework.Test

public class GrailsTestSuite
extends junit.framework.TestSuite

IoC class to inject properties of Grails test case classes.

Since:
0.1 Created: Aug 28, 2005
Author:
GraemeRocher, Steven Devijver

Constructor Summary
GrailsTestSuite(GrailsWebApplicationContext applicationContext, Class clazz, String testSuffix)
           
GrailsTestSuite(GrailsWebApplicationContext applicationContext, String testSuffix)
           
 
Method Summary
(package private)  void initControllerName(junit.framework.Test test, GrailsWebRequest webRequest)
          Some code under test will rely on the "controllerName" dynamic property.
 boolean isTransactional(junit.framework.Test test)
           
 void runTest(junit.framework.Test test, junit.framework.TestResult result)
           
 
Methods inherited from class junit.framework.TestSuite
addTest, addTestSuite, countTestCases, createTest, getName, getTestConstructor, run, setName, testAt, testCount, tests, toString, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GrailsTestSuite

public GrailsTestSuite(GrailsWebApplicationContext applicationContext,
                       String testSuffix)

GrailsTestSuite

public GrailsTestSuite(GrailsWebApplicationContext applicationContext,
                       Class clazz,
                       String testSuffix)
Method Detail

runTest

public void runTest(junit.framework.Test test,
                    junit.framework.TestResult result)
Overrides:
runTest in class junit.framework.TestSuite

isTransactional

public boolean isTransactional(junit.framework.Test test)

initControllerName

void initControllerName(junit.framework.Test test,
                        GrailsWebRequest webRequest)
Some code under test will rely on the "controllerName" dynamic property. This is normally done by DefaultUrlMappingInfo, but the URL mapping stuff doesn't happen in integration tests. So, we set it manually if the name of the test looks like "...Controller${testSuffix}". If the test name does not match a controller, then we set "controllerName" to a default value.

Parameters:
test - The test we're running.
webRequest - The Grails web request to set the controller name on.
To do:
this is horrible and dirty, should find a better way


Copyright (c) 2005-2009 The Grails project