Different class loader for integration tests?

View: New views
4 Messages — Rating Filter:   Alert me  

Different class loader for integration tests?

by Luke Daley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Why is this needed?

integrationTestsPreparation = {
     // We use a specialist test helper for integration tests.
     def app = appCtx.getBean(GrailsApplication.APPLICATION_ID)
     return new GrailsIntegrationTestHelper(grailsSettings,  
app.classLoader, resolveResources, appCtx)
}

In comparison to

functionalTestsPreparation = {
     return new DefaultGrailsTestHelper(grailsSettings, classLoader,  
resolveResources)
}



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Different class loader for integration tests?

by Peter Ledbrook :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> integrationTestsPreparation = {
>    // We use a specialist test helper for integration tests.
>    def app = appCtx.getBean(GrailsApplication.APPLICATION_ID)
>    return new GrailsIntegrationTestHelper(grailsSettings, app.classLoader,
> resolveResources, appCtx)
> }

If I remember correctly, GrailsIntegrationTestHelper creates instances
of GrailsTestSuite, which runs the tests in a transaction. This is
unnecessary for the functional tests.

Cheers,

Peter

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Different class loader for integration tests?

by Luke Daley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 29/10/2009, at 8:45 PM, Peter Ledbrook wrote:

>> integrationTestsPreparation = {
>>    // We use a specialist test helper for integration tests.
>>    def app = appCtx.getBean(GrailsApplication.APPLICATION_ID)
>>    return new GrailsIntegrationTestHelper(grailsSettings,  
>> app.classLoader,
>> resolveResources, appCtx)
>> }
>
> If I remember correctly, GrailsIntegrationTestHelper creates instances
> of GrailsTestSuite, which runs the tests in a transaction. This is
> unnecessary for the functional tests.

Sorry, should have been more specific.

Why the different class loader?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Different class loader for integration tests?

by Peter Ledbrook :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>> If I remember correctly, GrailsIntegrationTestHelper creates instances
>> of GrailsTestSuite, which runs the tests in a transaction. This is
>> unnecessary for the functional tests.
>
> Sorry, should have been more specific.
>
> Why the different class loader?

Ah, I hadn't noticed the "app.classLoader". To be honest, I have no
idea. I don't even know (without checking) whether it is a different
class loader. That said, remember that integration tests are run
within a bootstrapped environment, whereas functional tests run
against a servlet container rather than within it. If that makes
sense.

Cheers,

Peter

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email