Thx for your help. The state is always resetted between the tests.
My temporary solution for the problem ist to redesign the class. It is not 
singleton anymore. Perhaps I will deal with that problem again, later on.


-------- Original-Nachricht --------
> Datum: Sun, 21 Nov 2010 10:07:19 +0100
> Von: Vincent Latombe <[email protected]>
> An: Maven Users List <[email protected]>
> Betreff: Re: parallel execution of unit tests

> By default, all tests are runned in the same jvm instance, that's why your
> static assignments are not reset.
> 
> You have 2 solutions :
> - clean up the static state between each test
> - use forkMode = always. It will create a new jvm for each test. However,
> as
> you can understand, it will perform much slower
> 
> Vincent
> 
> 
> 2010/11/20 Kristian Rosenvold <[email protected]>
> 
> > It sounds *very* much to me like the static state is not being reset
> > properly; you're not running in parallel unless you're using some exotic
> > custom stuff.
> >
> > Did you try to run multiple tests at once from eclipse ?
> >
> > Kristian
> >
> >
> > lø., 20.11.2010 kl. 21.17 +0100, skrev Iron Eagle:
> > > Hi,
> > >
> > > thank you, for your awnser.
> > >
> > > I have no explicit configuration of the surefire plugin in my pom
> file. I
> > use the implicit default configuration of the plugin. I am not sure,
> whats
> > the default value for the "parallel" setting.
> > >
> > > At the end of each test method I reset the state of the singleton
> > instance to the initial state. So I am able to execute the test methods
> in
> > each order without failing. But in the case several methods run in
> parallel,
> > the side effects between the threads may cause the tests to fail.
> > >
> > > greetings
> > >
> > > -------- Original-Nachricht --------
> > > > Datum: Sat, 20 Nov 2010 19:55:06 +0100
> > > > Von: Kristian Rosenvold <[email protected]>
> > > > An: Maven Users List <[email protected]>
> > > > Betreff: Re: parallel execution of unit tests
> > >
> > > > The way I read your explanation, I am not entirely convinced
> anything
> > is
> > > > being run in parallel; look for the "maven-surefire-plugin" in your
> pom
> > > > and see if the "parallel" setting is active.
> > > >
> > > > Much more likely you have static state in your tests that fails when
> > > > multiple test methods are being run in the same vm invocation. If
> you
> > > > try to run ALL the tests within the class at once from eclipse I bet
> > > > they will fail. In this case you simply need to reset the static
> state
> > > > between each test.
> > > >
> > > >
> > > > Kristian
> > > >
> > > > state, and does not
> > > > lø., 20.11.2010 kl. 18.22 +0100, skrev Iron Eagle:
> > > > > Hi,
> > > > >
> > > > > I have a problem with the junit (3.8.1) tests in a mvane project.
> > While
> > > > each unit test is successfull when I start it within eclipse, maven
> > fails,
> > > > when executing the tests.
> > > > >
> > > > > I figured out, that the test methods of my junit test are executed
> > > > parallel. This is bad, since the class under test is singleton. So
> in
> > every test
> > > > method, the same instance is used. This has side effects in each
> test
> > > > method, what leads into a failure.
> > > > >
> > > > > Is this a known problem? is there a simple way to force s
> sequential
> > > > execution of the unit tests? (I use junit 3.8.1, so I can not use
> > anotations
> > > > like @Depends)
> > > > >
> > > > > best regards
> > > > >
> > > >
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [email protected]
> > > > For additional commands, e-mail: [email protected]
> > > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >

-- 
GMX.at - Österreichs FreeMail-Dienst mit über 2 Mio Mitgliedern
E-Mail, SMS & mehr! Kostenlos: http://portal.gmx.net/de/go/atfreemail

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to