You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by bryan hansen <bh...@yahoo.com> on 2005/06/22 15:32:28 UTC

Re: Singletons/static variables and Unit testing

This was actually my understanding too. We made a
class that builds a test suite dynamically based off
of a directory (starting point) and it now runs all of
our tests in under 2 minutes instead of 30.

Thanks,

Bryan

--- Siegfried Goeschl <si...@it20one.at>
wrote:

> Hi Bryan,
> 
> I think Maven is not guilty but your approach using
> static initializer 
> and singletons is improvable
> 
> The JUNIT way
> 
> +) of defining a lifecycle for an individual test
> case is setup() and 
> tearDown()
> +) of providing resources shared across multiple
> testsuites is using a 
> TestSetup
> 
> The only trouble is that executing individual tests
> is not possible 
> since they depend on running the TestSetup before
> 
> Cheers,
> 
> Siegfried Goeschl
> 
> bryan hansen wrote:
> 
> >We are using maven to run our Unit Tests which are
> >accessing the database through Hibernate. It seems
> >that when Maven builds the test suite it is
> >reconfiguring hibernate before each TestCase. So if
> >there are 3 tests in a class it will run those with
> >the same configuration, but when it goes to the
> next
> >test it will reconfigure hibernate again. I have
> the
> >configuration code in a static initializer and am
> >accessing it from a Singleton (in fact I copied it
> >from Hibernate's website) and it is still doing it.
> I
> >have tried setting the various properties for
> testing
> >and can't seem to make a difference:
> >
> >maven.junit.fork=true
> >maven.junit.jvm=java
> >
> >It has gotten to the point that the build box is
> >throwing out of memories errors because it is
> trying
> >to allocate so many resources.
> >
> >The only step I can think to do next is to not have
> >maven build my test suite and instead create on
> >myself, but I am afraid that it will become
> >unmaintainble because of all the test cases we
> have.
> >
> >Any ideas?
> >
> >Thanks,
> >
> >Bryan
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> >http://mail.yahoo.com 
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> users-unsubscribe@maven.apache.org
> >For additional commands, e-mail:
> users-help@maven.apache.org
> >
> >
> >  
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@maven.apache.org
> For additional commands, e-mail:
> users-help@maven.apache.org
> 
> 



		
____________________________________________________ 
Yahoo! Sports 
Rekindle the Rivalries. Sign up for Fantasy Football 
http://football.fantasysports.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Singletons/static variables and Unit testing

Posted by Marcell Manfrin Barbacena <ba...@gmail.com>.
That what you can do:

1. Define a Test Suite with all your tests.
2. Define your pom like that:
<unitTest>
  <includes>{The TestSuite you created in (1)}</includes>
  <excludes>{All tests included at the TestSuite in (1)}</excludes>
</unitTest>

[]'s

On 6/22/05, bryan hansen <bh...@yahoo.com> wrote:
> This was actually my understanding too. We made a
> class that builds a test suite dynamically based off
> of a directory (starting point) and it now runs all of
> our tests in under 2 minutes instead of 30.
> 
> Thanks,
> 
> Bryan
> 
> --- Siegfried Goeschl <si...@it20one.at>
> wrote:
> 
> > Hi Bryan,
> >
> > I think Maven is not guilty but your approach using
> > static initializer
> > and singletons is improvable
> >
> > The JUNIT way
> >
> > +) of defining a lifecycle for an individual test
> > case is setup() and
> > tearDown()
> > +) of providing resources shared across multiple
> > testsuites is using a
> > TestSetup
> >
> > The only trouble is that executing individual tests
> > is not possible
> > since they depend on running the TestSetup before
> >
> > Cheers,
> >
> > Siegfried Goeschl
> >
> > bryan hansen wrote:
> >
> > >We are using maven to run our Unit Tests which are
> > >accessing the database through Hibernate. It seems
> > >that when Maven builds the test suite it is
> > >reconfiguring hibernate before each TestCase. So if
> > >there are 3 tests in a class it will run those with
> > >the same configuration, but when it goes to the
> > next
> > >test it will reconfigure hibernate again. I have
> > the
> > >configuration code in a static initializer and am
> > >accessing it from a Singleton (in fact I copied it
> > >from Hibernate's website) and it is still doing it.
> > I
> > >have tried setting the various properties for
> > testing
> > >and can't seem to make a difference:
> > >
> > >maven.junit.fork=true
> > >maven.junit.jvm=java
> > >
> > >It has gotten to the point that the build box is
> > >throwing out of memories errors because it is
> > trying
> > >to allocate so many resources.
> > >
> > >The only step I can think to do next is to not have
> > >maven build my test suite and instead create on
> > >myself, but I am afraid that it will become
> > >unmaintainble because of all the test cases we
> > have.
> > >
> > >Any ideas?
> > >
> > >Thanks,
> > >
> > >Bryan
> > >
> > >__________________________________________________
> > >Do You Yahoo!?
> > >Tired of spam?  Yahoo! Mail has the best spam
> > protection around
> > >http://mail.yahoo.com
> > >
> >
> >---------------------------------------------------------------------
> > >To unsubscribe, e-mail:
> > users-unsubscribe@maven.apache.org
> > >For additional commands, e-mail:
> > users-help@maven.apache.org
> > >
> > >
> > >
> > >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > users-unsubscribe@maven.apache.org
> > For additional commands, e-mail:
> > users-help@maven.apache.org
> >
> >
> 
> 
> 
> 
> ____________________________________________________
> Yahoo! Sports
> Rekindle the Rivalries. Sign up for Fantasy Football
> http://football.fantasysports.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 


-- 
"Nobody knows who i really am
 I never felt this empty before
 And if I never need someone to come along
 Who's gonna comfort me and keep me strong?"
--
Marcell Manfrin Barbacena
barbacena@gmail.com
MSN Messenger: marcell84bruk@hotmail.com
ICQ UIN: 63671762
Skype: callto://marcell84bruk
+55 (83) 8808-8555 (Oi)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org