[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [riena-dev] Test friendly LOGGER pattern
|
Carsten,
the speedup is only noticeable for tests that run for a short time (=an individual test that is run over and over, like when developing). When we run all the tests (=build server) the total test duration is much longer than the start-up time, so we don't gain anything.
That why personally I don't see a need for adding the annotation.
Greetings,
Elias.
On Wed, Mar 4, 2009 at 11:23 PM, Drossel, Carsten
<Carsten.Drossel@xxxxxxxxxxxx> wrote:
Maybe we can extend the TestCollector with a new annotation @PlugInTest...? Then we could have two additional test suites AllPlugInTests and AllNonPlugInTests.
Would that be much faster or is the speed gain only noticeable for single tests?
Greetings,
Carsten
Von: riena-dev-bounces@xxxxxxxxxxx [mailto:riena-dev-bounces@xxxxxxxxxxx] Im Auftrag von Elias Volanakis
Gesendet: Donnerstag, 5. März 2009 01:59
An: Riena Developers list
Betreff: [riena-dev] Test friendly LOGGER pattern
Just a quick tip:
If you use static LOGGER fields, I recommend using the pattern (b) below. It avoids a NPE exception when calling Activator.getDefault().getLogger(), which usually happens when running test suites as "plain" junit tests.
(a) Problematic with Junit:
public final class MyClass {
private static final Logger LOGGER = Activator.getDefault().getLogger(ImageStore.class);
(b) Works well with Junit:
public final class MyClass {
private static final Logger LOGGER;
static {
if (Activator.getDefault() != null) {
LOGGER = Activator.getDefault().getLogger(MyClass.class);
} else {
LOGGER = new ConsoleLogger(MyClass.class.getName());
}
}
I know that some test cases must be run as "plug-in" tests, but I usually run individual test cases for stuff I'm working on as "regular" unit-tests, because they start much faster :-)
Viele Gruesse,
Elias.
_______________________________________________
riena-dev mailing list
riena-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/riena-dev
--
Elias Volanakis
Technical Lead
Innoopract (EclipseSource)
351 NW 12th Avenue
Portland, Oregon 97209
elias@xxxxxxxxxxxxxxxxx
evolanakis@xxxxxxxxxxxxxxTel: +1-503-552-1457
Fax: +1-503-715-4915
Mobile: +1-503-929-5537
---
Innoopract is becoming EclipseSource -
www.eclipsesource.com