• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

junit AssertionFailedError  RSS feed

 
Ranch Hand
Posts: 89
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Nidhi Singhal
Ranch Hand
Posts: 89
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see.

Can you show us the code of the testcase class, please?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!