The reason for your test showing as unrooted test in Eclipse and JUnit 4 is:-
1) You may not have specified the annotation: @Test for your test method.
2) Your test method must be declared public.
3) Make sure in Eclipse you project is building properly. You should idealy select "Build Automatically" from Project menu.
4) If above does not help then clean and rebuild your project manually.
hope this helps.
One small thing that made it work for me was just include the line
"@Test"
as shown in the following example:
// unit testing private methods in Matrix Class
@Test
public void testGetStructureSteps()
{
Element depletionSteps = null;
Element expectedResult = null;
try
{
...
when I did not had that "@Test" before I was getting the "unrooted tests" error message.
I hope this helps you.
Paulo Brasko
Bradley, Todd wrote:
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.
----
Todd Bradley - Polycom, Inc.
ReadiVideo QA Lead