Hello Mick, I am not really doing "DB unit testing", my backend code (the core business logic) never interacts with the DB. I am trying to unit test only the business logic code. The DB code is merely to load test data and push that data into the business logic classes. The test servlets are the entry point to these unit tests using a browser.
I am doing similar to what Stephen suggested in an earlier mail. I have 1. "core" jar project. Installed the jar in my local repo. 2. war project containing only test code and servlets/jsps. This has a dependency on #1 jar. This seems to be a little troublesome to maintain 2 projects, but it kind of solves the issue for now. Thanks, Subhro. On Sat, Feb 14, 2009 at 10:45 PM, Mick Knutson <[email protected]>wrote: > I currently have a data-services.jar that contains all my db code. with > TestNG, DBUnit and MySql & H2, I run full integration tests. my integration > test coverage is >85% total coverage. I test both h2 in-memory, then run > again against my MySql once I am on my build server. H2 is just faster for > local developer testing > > Look at how appfuse does their db testing. > > You should NEVER put db test code into a war just to get around > re-designing > your code. It sounds like you need to change your test harness to isolate > that service. > > --- > Thank You… > > Mick Knutson, President > > BASE Logic, Inc. > Enterprise Architecture, Design, Mentoring & Agile Consulting > p. (866) BLiNC-411: (254-6241-1) > f. (415) 685-4233 > > Website: http://baselogic.com > Linked IN: http://linkedin.com/in/mickknutson > Twitter: http://twitter.com/mickknutson > Vacation Rental: http://tahoe.baselogic.com > --- > > > > On Sat, Feb 14, 2009 at 8:54 AM, Subhrajyoti Moitra > <[email protected]>wrote: > > > Hello, > > > > My client wants to "unit test" the core components of this application. > > So, i went about creating a very simple test harness (1 test servlet+2 > jsp) > > to trigger the unit test-data load (mysql DB), as well as running the > unit > > tests. > > A simple report is generated at the end of the test and shown to the > > client. > > > > I am not sure if this is called integration testing. > > > > Selenium did come to my mind, but that would become end-to-end testing > and > > mostly involving browsers. My module is just a backend service, with a > > servlet front to invoke the services. > > > > I have as usual written all my test classes/servlets in src/test/java. > > From command line, i run my unit tests(skipping the servlet part) and > it's > > all fine. But i am not really keen to share source code with the client > > until i get paid for it.:) > > which means i have to give an interface(GUI) to trigger these unit tests, > > with clients own test data. > > > > So, now i want to include all these test classes/servlet in my war and > send > > it to client for "unit test". M2 is not including these test files in the > > build. > > > > Any other alternative ideas, as how can clients do "unit test" without > > access to source code? > > Is there anyone else in this list faced with a similar problem? Please > > advice. > > > > Thanks in advance. > > Subhro Moitra. > > > > > > On Sat, Feb 14, 2009 at 9:42 PM, Mick Knutson <[email protected]> > > wrote: > > > > > why would you want test classes in a war? Integration testing? Look at > > > Selenium instead. > > > > > > --- > > > Thank You… > > > > > > Mick Knutson, President > > > > > > BASE Logic, Inc. > > > Enterprise Architecture, Design, Mentoring & Agile Consulting > > > p. (866) BLiNC-411: (254-6241-1) > > > f. (415) 685-4233 > > > > > > Website: http://baselogic.com > > > Linked IN: http://linkedin.com/in/mickknutson > > > Twitter: http://twitter.com/mickknutson > > > Vacation Rental: http://tahoe.baselogic.com > > > --- > > > > > > > > > > > > On Sat, Feb 14, 2009 at 7:29 AM, Subhrajyoti Moitra > > > <[email protected]>wrote: > > > > > > > Hi, > > > > I am using maven2 to build a war. > > > > In my src/test/java i have some test servlets which are also to be > > > included > > > > in the distribution. It seems that the default war packaging only > takes > > > > into > > > > account the src/main/java classes. > > > > > > > > Please advice, how I can include all the test files as well in the > war? > > > > > > > > Thanks a lot in advance. > > > > Subhro. > > > > > > > > > >
