You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Felix Knecht <fe...@otego.com> on 2010/06/09 11:42:23 UTC

Test @Before vs @BeforeClass

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

IMO there exists multiple tests making inefficent use of the @Before
annotation (which is executed before each test method) e.g. [1]. Using
@BeforeClass would be run only once before all test methods.
For sure their exists cases where it's needed to reinitialize variables
before each single test, but this will make it (for those tests)
impossible to run them //.

Can I move them to @BeforeClass where possible?

Regards
Felix

[1]
http://people.apache.org/~felixk/apacheds-docs/xref-test/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwPYf8ACgkQ2lZVCB08qHFuLACeICfpS33RnwXz4oZ7Qmco+poZ
IgIAoLv+x3bJLrPSxImBZxR1jUP1L5rt
=0T4q
-----END PGP SIGNATURE-----

Re: Test @Before vs @BeforeClass

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 6/9/10 11:42 AM, Felix Knecht wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> IMO there exists multiple tests making inefficent use of the @Before
> annotation (which is executed before each test method) e.g. [1]. Using
> @BeforeClass would be run only once before all test methods.
> For sure their exists cases where it's needed to reinitialize variables
> before each single test, but this will make it (for those tests)
> impossible to run them //.
>
> Can I move them to @BeforeClass where possible?
>    
Sure !

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com