My tests extend the spring class AbstractTestNGSpringContextTests.
I implemented a couple of tests and for all of them I'd like to setup the
tests using a @BeforeSuite annotated method. Within this method I
instantiate some classes via the applicationContext.
The point is, the applicationContext is loaded after execution of the
@BeforeSuite annotated method.
This is not what I would expect. How is it intended to initialize the tests
?
The sequence of execution is like this:
...
[Invoker 2745175] Invoking @BeforeSuite test.Init.setUp()
...
2007-10-30 16:20:30,562 DEBUG
[org.springframework.test.context.support.AbstractGenericContextLoader] -
Loading ApplicationContext for locations
[classpath:/testing-config.xml,classpath:/testing-config.xml].
...
--
View this message in context: http://www.nabble.com/Spring-2.5---TestNG---Sequence-of-Initialization-tf4719321.html#a13491227
Sent from the testng-users mailing list archive at Nabble.com.
I posted a similar message in the spring forum and in the meanwhile I am
pretty sure that Spring needs to be changed in a way that the
applicationContext is even set when @BeforeSuite is called.
Currently the spring context is set on @BeforeClass Level as you can see in
the sourcecode below:
/**
* Delegates to the configured {@link TestContextManager} to
* {@link TestContextManager#prepareTestInstance(Object) prepare} this test
* instance prior to execution of any individual test methods, for example
* for injecting dependencies, etc.
*
* @throws Throwable if a registered TestExecutionListener throws an
* exception.
*/
@BeforeClass(groups = { "SpringTestContext" })
protected void springTestContextPrepareTestInstance() throws Throwable {
this.testContextManager.prepareTestInstance(this);
}
However, I did not get a response so far and I just posting this again here,
because somewhere in this forum I read that you guys have been involved in
the discussion about the new testing framework in spring together with the
people from interface21.
That's why I was just wondering what your statement is about this...
Maybe I misuse TestNG in combination with Spring - on the other hand using
spring the very first thing what needs to be done is accessing the
application context and the very first step in TestNg is @BeforeSuite, isn't
it?
And my question to the community is: Did somebody else use Spring 2.5 in
combination with TestNG already and what are the experiences so far?
--
View this message in context: http://www.nabble.com/Spring-2.5---TestNG---Sequence-of-Initialization-tf4719321.html#a13529679
I've been in vacation for the last couple of weeks, so I haven't
really got the time to look over the integration with Spring.
Hopefully, I will be able to start looking into this in the upcoming
weeks (even if I will have to catch up with my work).
./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator
this is in fact a change which needs to be done in Spring.
See: http://forum.springframework.org/showthread.php?t=45603
Let's wait for the next built of Spring 2.5...
Cheers,
Tom
--
View this message in context: http://www.nabble.com/Spring-2.5---TestNG---Sequence-of-Initialization-tf4719321.html#a13663221