aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes junit AssertionFailedError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "junit AssertionFailedError" Watch "junit AssertionFailedError" New topic
Author

junit AssertionFailedError

Nidhi Singhal
Ranch Hand

Joined: Sep 19, 2004
Posts: 89

Hi,

I get the following error whenever I run a test case:

junit.framework.AssertionFailedError: No tests found in <path of test class>

I am using JUnit 4 for testing. The class contains tests methods denoted by @Test.

I am unable to understand as to why I am getting the above error.

-Nidhi
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
So is your other problem at http://www.coderanch.com/t/108617/tools/JUnit-error resolved?

*How* to you try to run the tests? Are you using the string "<path of test class>" somewhere? You will probably need to replace that string with, well, the actual path of the test class...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Nidhi Singhal
Ranch Hand

Joined: Sep 19, 2004
Posts: 89

Thanks.

My last problem has got resolved. It was a compile time error as it was unable to find a jar file.

In the below error statement:
junit.framework.AssertionFailedError: No tests found in <path of test class>

By string <path of test class> I mean to say that the error shows the path of the test class here.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
I see.

Can you show us the code of the testcase class, please?
Armando Cervantes
Greenhorn

Joined: Nov 29, 2006
Posts: 1
Hey there,

Was your problem resolved? I am having the same issue and the test code I am running came straight from the JUnit FAQ page:

package junitfaq;

import org.junit.*;
import static org.junit.Assert.*;
import java.util.*;

public class UtilTest {

private Collection<Object> collection;

@Before
public void setUp() {
collection = new ArrayList<Object>();
}

@Test
public void testEmptyCollection() {
assertTrue(collection.isEmpty());
}

/*
@Test
public void testOneItemCollection() {
collection.add("itemA");
assertEquals(1, collection.size());
}
*/
}

If you can share your solution that would be great!

Thanks,
Armando
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Same question: How are you trying to run the test?

My first guess would be that your test runner is expecting a JUnit 3 testcase.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: junit AssertionFailedError
 
Similar Threads
Ant and JUnit (Build Failed)
hibernate MappingException: duplicate import
PowerMock Test mechanism error
JUnit and AbstractTestCase Problem
Add testSuites to other test suites?