Re: Proper Wonder/App Initialization for testing
Re: Proper Wonder/App Initialization for testing
- Subject: Re: Proper Wonder/App Initialization for testing
- From: Denis Frolov <email@hidden>
- Date: Tue, 22 Sep 2009 13:05:45 +0400
Here is what we do using JUnit 4:
1. Add a super-class for all your test classes, e.g.:
public class IntegrationTest {
@BeforeClass
public static void init() {
ERXExtensions.initApp(Application.class, new String[0]);
}
}
2. Extend your test classes from IntegrationTest, e.g.:
public class ArtistTest extends IntegrationTest {
@Test
public void songsAreDeletedWhenArtistIsDeleted() {
// Create test objects
assertThat(...);
}
Normally, we have 3 types of tests:
1. Unit tests (do not require app initialization, use mocks, run with
JUnit, are very fast).
2. Integration tests (require app initialization, use real db, run
with JUnit, are slow).
3. Acceptance tests (require running app, use real db and browser, run
with Selenium or WebDriver, are very slow).
And we have three source folders for each kind of tests:
1. Tests/Unit
2. Tests/Integration
3. Tests/Acceptance
Unit and Integration tests can be run from Eclipse using JUnit runner
by choosing "Run As -> JUnit Test" either on the whole Tests/...
folder or on specific test.
Unit tests are also run from Hudson using ant upon each commit.
Integration and Acceptance tests are too slow and are run once a day
or manually before deployment.
ps: @BeforeSuite would most probably work as well (it's just we are
not using TestNG).
On Mon, Sep 21, 2009 at 7:55 PM, Greg Brown <email@hidden> wrote:
> Hi,
>
> I converted an app to use Wonder, and I think my tests need do do something
> new so that all the Wonder stuff initializes properly.
>
> This page:
> http://wiki.objectstyle.org/confluence/display/WONDER/Integrate+Wonder+Into+an+Existing+Application
>
> has nothing about tests ;>o
>
> Unit type tests seem to run fine without initializing the wonder frameworks,
> but database type (dbuinit) tests probably need the wonder stuff to be
> properly initialized.
>
> ERXExtensions has a bunch of initApp, initEOF, initialize methods, which one
> is generally best for testNG / dbuinit initializations? Or do I need
> something like an initApp followed by a initEOF?
>
> How do people handle this? a @BeforeSuite annotation to a method which calls
> some er.extensions.ERXExtensions.initFoo()?
>
>
>
> Thanks,
>
> gb
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden