At my company (Spoke Software), I just finished creating an acceptance test framework. So for unit tests, I just construct the Action and run execute() by hand. All other stuff is caught in the acceptance tests.
The way the framework works is: we use JWebUnit and provide a SpokeTestCase base class for everyone to use. This classes setUp() method: 1) connects to our test DB 2) kills all open connections 3) restores the DB from a DB backup snapshot that is in CVS 4) tells our various servers (3 of them) to "reset", meaning the connection pool is restarted, caches are cleared, etc 5) sets the base URL for JWebUnit to http://localhost This works REALLY well, especially since JWebUnit is based off of HttpUnit and has JavaScript support. We've since added helper methods to our SpokeTestCase for validating emails were sent as well. And no, we don't use DBUnit nor an in-memory DB (we use MS SQL Server), but each test takes ~3sec, so it's not too bad when run nightly. -Pat ----- Original Message ----- From: "Francisco Hernandez" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, October 06, 2003 2:44 AM Subject: Re: [OS-webwork] testing web applications > ooh thanks for letting me know about dbunit, and now that you mention > ant, another tool i need to get deeper into, where will the madness stop!? > > Cameron Braid wrote: > > I don't think that you need to run tests against your live data. > > > > We do the following > > > > A) provide ant tasks to (re)create the database > > since we are using hibernate this is easy > > > > B) provide ant tasks to populate the database with the test data > > we use DBUNIT to insert the data from an xml dataset. > > http://dbunit.sourceforge.net/ > > > > C) use junit for unit tests > > > > When we write unit tests we also create a dataset file. This dataset > > file is inserted into the database prior to running the test method (in > > setUp()) > > > > > > Having these tasks allow for the testing process to be fully automated > > by starting with the code and an empty database. > > > > When we discover a bug that somehow gets into production, we > > * use a dbunit task to scrape relevant data from the production database > > into an xml file dataset. > > * using dbunit to import that dataset into the development database to > > reproduce the bug offline. > > * then create a unit test that reproduces the bug using as small a > > dataset as possible. > > > > > > > > > >>-----Original Message----- > >>From: [EMAIL PROTECTED] > >>[mailto:[EMAIL PROTECTED] On > >>Behalf Of Francisco Hernandez > >>Sent: Monday, 6 October 2003 5:43 PM > >>To: [EMAIL PROTECTED] > >>Subject: Re: [OS-webwork] testing web applications > >> > >> > >>so i need to write tests to for successfull conditions and then also > >>failure conditions, I was planning on having the tests all > >>work against > >>a test database so i dont touch my live data. > >> > >>Robert Douglass wrote: > >> > >>>I make sure to write tests that break the code too. So the > >> > >>first test > >> > >>>I run is said action without any input parameters, for > >> > >>example. Then > >> > >>>with bad parameters. The bad tests have to all fail before > >> > >>I test the > >> > >>>correct case. And, by the way, make sure you have worked > >> > >>out whether > >> > >>>you're going change state in your database (or whatever persistence > >>>mechanism you use). Always write your tests so that you can > >> > >>run them > >> > >>>on a live application, if you can, without risking data loss etc. > >>> > >>>-RD > >>> > >>>-----Original Message----- > >>>From: [EMAIL PROTECTED] > >>>[mailto:[EMAIL PROTECTED] > >> > >>Behalf Of > >> > >>>Francisco Hernandez > >>>Sent: Monday, October 06, 2003 6:16 AM > >>>To: [EMAIL PROTECTED] > >>>Subject: [OS-webwork] testing web applications > >>> > >>> > >>>hey guys, im new to unit testing and am wondering what kind > >> > >>of tests > >> > >>>you guys do you your apps > >>> > >>>for example I have an action that creates a user, do you > >> > >>guys simply > >> > >>>populate the parameters and execute the action and then > >> > >>check to see > >> > >>>if the user exists with the correct data in the datastore? > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>>------------------------------------------------------- > >>>This sf.net email is sponsored by:ThinkGeek > >>>Welcome to geek heaven. > >>>http://thinkgeek.com/sf > >>>_______________________________________________ > >>>Opensymphony-webwork mailing list > >>>[EMAIL PROTECTED] > >>>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > >>> > >>> > >>> > >>>------------------------------------------------------- > >>>This sf.net email is sponsored by:ThinkGeek > >>>Welcome to geek heaven. > >>>http://thinkgeek.com/sf > >>>_______________________________________________ > >>>Opensymphony-webwork mailing list > >>>[EMAIL PROTECTED] > >>>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > >>> > >>> > >>> > >> > >> > >> > >> > >> > >>------------------------------------------------------- > >>This sf.net email is sponsored by:ThinkGeek > >>Welcome to geek heaven. > >>http://thinkgeek.com/sf > >>_______________________________________________ > >>Opensymphony-webwork mailing list > >>[EMAIL PROTECTED] > >>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > >> > >> > > > > > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Opensymphony-webwork mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > > > > > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork