It can be useful if it's injecting stateful services. If it injects them BeforeClass, then you can have state from one test affecting others. Not all services are singleton-scoped.

Christian.

On 2009-07-15, at 01:32 , Paul Field wrote:

Hi Christian,

It might make sense to have a "hit" annotation for Testify that
follows @Inject which allows the injection to be beforeMethod or
beforeClass.  Unfortunately, we can't re-use the jUnit ones because
(if I recall correctly) they are not suitable for Field annotation,
just method.  But something similar would be good.  Maybe
@InjectBeforeTest and @InjectBeforeSuite could do it.

I'm not seeing why that would be useful. I would expect the @Inject
annotation to be injecting the same object whenever it is processed - it's just a question of when that injection takes place for each instance of
the test class (e.g. at the start of the test class/before each test
method).

JUnit (3 and I assume 4) makes a new instance of the test class to run
each test method, so it makes sense to process @Inject for every test
method in order to populate that new instance.

TestNG makes one instance of the test class for all the test methods in
it, so it makes sense to process @Inject just once using TestNG's
@BeforeClass.

As usual, I may have missed something so feel free to educate me :-)

- Paul


---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e- mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.

Christian Edward Gruber
e-mail: christianedwardgru...@gmail.com
weblog: http://www.geekinasuit.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to