Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The most obvious question to ask here is whether you are running this test as a unit test or as an integration test. As <a href="http://grails.org/doc/latest/guide/9.%20Testing.html#9.1%20Unit%20Testing" rel="nofollow">noted in the Testing section of the User Guide</a>, GroovyPagesTestCase needs to be run as an integration test, rather than a unit test.</p> <p>In particular, it relies on a <code>GroovyPagesTemplateEngine</code> being injected into the test class and a request context being set in the <a href="https://src.springframework.org/svn/spring-framework/trunk/org.springframework.web/src/main/java/org/springframework/web/context/request/RequestContextHolder.java" rel="nofollow">RequestContextHolder</a>. The latter you may be able to fake out <a href="https://github.com/grails/grails-core/blob/master/grails-plugin-testing/src/main/groovy/grails/test/MvcUnitTestCase.groovy#L122" rel="nofollow">similar to the what the MvcUnitTestCase does</a>, the former, though, I am unsure how you can address without making the test an integration test (it really depends on the dependencies of <code>GroovyPagesTemplateEngine</code>).</p> <p>Of course, if you really are trying to unit test such a simple TagLib, it may be easier just to follow the suggestion <a href="http://grails.org/doc/latest/guide/9.%20Testing.html#9.1%20Unit%20Testing" rel="nofollow">also found in the User Guide</a>, and do something like this:</p> <pre><code>class FooTabLibTest extends GroovyTestCase { void testBar1() { assertEquals "&lt;p&gt;Hello World!&lt;/p&gt;", new FooTagLib().bar(null, null).toString() } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload