WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

 « Return to Thread: what's an "Unrooted Test" and why can't I find anything online about it?

RE: what's an "Unrooted Test" and why can't I find anything online about

by Bradley, Todd (CW) :: Rate this Message:

| View in Thread

So, I just wanted to answer my own question, to close the loop on this
matter.  If you have a class that uses pure JUnit 4 style, then you can
run individual test methods without getting the "Unrooted Test" problem.
In other words, don't extend TestCase (or a subclass of TestCase).

In my own case, even though I thought I was using annotations to mark my
@Test methods, Eclipse was using the JUnit 3 compatibility mode.
Eclipse's test runner insisted to run all methods whose names start with
"test".

To follow up to a few other posts:

David Saff wrote:
> Did the first class have a suite() method or @RunWith annotation?

No.  Neither.  It doesn't seem to be related to test suites.


Ayub wrote:
> We are using classes that extend TestCase. We cant use the
> new Junit4 annotations because we are dependant on code in
> the parent classes.

We had the same issue.  However, we created a new parent class that has
all the useful code the old parent did, but doesn't inherit from
TestCase.  Now we're all switched over to doing things the new way,
which makes it easier to use Eclipse and JUnit together.

Joakim Ohlrogge wrote:
> I have managed to cause unrooted tests earlier in my
> RSpec-JUnit hack. Based on that experience an "unrooted test"
> is a test that is run without having been declared previously
> by the runner (in my case I had to fix my runner
> implementation that was, no doubt, not behaving acording to
> spec). It would probably not hurt to ask this question in an
> Eclipse forum aswell, it seems that exlipse single-test
> runner is doing something that is not quite correct.

I think you're right about the Eclipse test runner not being quite
correct.  But I'm not on any Eclipse forums, and I'm skeptical they
would fix the problem anyhow since it's been there for years without
(apparently) too many complaints.  Plus, the workaround of refactoring
our tests to use pure JUnit 4 is working, and is good enough for me.


Cheers,
Todd.






> -----Original Message-----
> From: junit@... [mailto:junit@...] On
> Behalf Of Bradley, Todd
> Sent: Tuesday, December 18, 2007 4:14 PM
> To: junit@...
> Subject: RE: [junit] what's an "Unrooted Test" and why can't
> I find anything online about
>
> I had a few minutes to look into this over lunch today.  What
> I learned is that when I had a test case that was a subclass
> of TestCase (to be specific, my test case was a subclass of a
> subclass of TestCase), I had the "Unrooted Test" problem.  
> When I made a test case in a new project from scratch that
> didn't extend TestCase but only used @Test annotations,
> Eclipse didn't run the unrooted tests.
>
> When I get some more time, I want to dig into it more and try
> to figure out why this is the case.  But I'm stuck in backlog
> estimation for the next 3 days, and then it's Christmas.  So
> I may not have time to investigate any more until the new year.
>
>
> Todd.
>  
>
> -----Original Message-----
> From: junit@... [mailto:junit@...] On
> Behalf Of edu_kumar
> Sent: Monday, December 17, 2007 7:44 PM
> To: junit@...
> Subject: Re: [junit] what's an "Unrooted Test" and why can't
> I find anything online about
>
> Hey Todd,
>
> I too got the same issue, If I execute only one unit test
> case as opposed to the whole class. It does shown me
> 'Unrooted Tests' in the Junit output screen.
>
> I tried investigating on this in net but found nothing about
> it. But i did find similar (infact exact) issues in google code base.
> Surprisingly, when I checked the same issue today it was removed.
>
> I guess we've two options with us now..
>
> 1) Ask in the JUnit developer forums, the same question and
> wait for the answer
> 2) Check in the code directly for any reference to 'Unrooted tests'.
>
> Please let me know,if you find any updates on this issue...
>
> Regards,
> Sarat.
>
> --- In junit@..., Per Jacobsson <perjacobsson@...> wrote:
> >
> > I'm running Eclipse 3.3 and Junit 4.4. A single test in outline view
> works fine here.
> > / Per
> >
> > ________________________________
> > From: junit@... [mailto:junit@...] On Behalf
> Of Bradley, Todd
> > Sent: Monday, December 17, 2007 3:00 PM
> > To: junit@...
> > Subject: RE: [junit] what's an "Unrooted Test" and why can't I find
> anything online about it?
> >
> >
> > Hi, does anyone have advice in this area? Am we the only
> people using
> > JUnit 4.4 with Eclipse 3.3, or just the only ones who are having
> > problems with it?
> >
> > Cheers,
> > Todd.
> >
> > > -----Original Message-----
> > > From: junit@...<mailto:junit%40yahoogroups.com>
> [mailto:junit@...<mailto:junit%40yahoogroups.com>] On
> > > Behalf Of Bradley, Todd
> > > Sent: Thursday, December 13, 2007 3:38 PM
> > > To: junit@...<mailto:junit%40yahoogroups.com>
> > > Subject: [junit] what's an "Unrooted Test" and why can't I find
> > > anything online about it?
> > >
> > > I'm using Eclipse 3.3 with JUnit 4.4. In the olden days, with
> > > Eclipse 3.0 and JUnit 3.8, I could select a single test method in
> > > the Outline view and run just that method.
> > > Nowadays, whenever I try to do that, Eclipse's test
> runner runs all
> > > the tests in the class. The results are shown in a tree, and the
> > > tests I didn't ask to be run are all under a node called
> "Unrooted
> > > Tests [Runner: JUnit 4]".
> > >
> > > So, I figured there must be some simple explanation, and
> immediately
>
> > > did a Google search. And it found nothing on topic. So I searched
> > > the Eclipse documentation and website for "unrooted
> tests" and again
>
> > > got nothing. So I searched on this Yahoo Group's message archive,
> > > and again found nothing.
> > >
> > > Am I the only person in the world who has ever had this
> problem with
>
> > > running a single test method from Eclipse? Or am I
> searching for the
>
> > > web's most suppressed secret?
> > >
> > > Someone please tell me you've seen this problem too! And why is
> > > there nothing written up about these mysterious "Unrooted
> Tests" in
> > > all the places I looked?
> > >
> > >
> > > Cheers,
> > > Todd.
> > > ----
> >
> > .
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>
>
>  
> Yahoo! Groups Links
>
>
>
>
>
>  
> Yahoo! Groups Links
>
>
>
>

 « Return to Thread: what's an "Unrooted Test" and why can't I find anything online about it?