Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Junit error

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
I am running java class extending testcase in Eclipse IDE 3.2 adding junit4.1.jar in external libraries, I got failure as 1 with the following warning junit.framework.AssertionFailedError: No tests found , please help me.
Thanks,
Bhargavi
 
Bartender
Posts: 2653
18
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to post your test class code to allow us to give good info.

Most often this error occursd when you're mixing JUnit 3 and JUnit 4 functionality.
Like:
  • Your test class inherits from TestCase (junit 3 style)
  • and your test methods are annotated with @Test.
  • Show your code, and we'll be able to help you better.

    Regards, Jan
     
    Jayasri Alaparthi
    Ranch Hand
    Posts: 67
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hai Jan,
    Thanks for giving response, here is my code and I used junit4 test in Eclipse3.2 and import external lib of junit-4.1 jar file and wrote the code as such

    package com;

    import junit.framework.TestCase;


    public class aaaa extends TestCase {
    public aaaa(String name){
    super(name);
    }



    public void sayTest(){

    int answer = 2;
    assertEquals((1+1), answer);
    }
    }
    I got the error junit.framework.AssertionFailedError: No tests found in com.aaaa
    at junit.framework.Assert.fail(Assert.java:47)
    at junit.framework.TestSuite$1.runTest(TestSuite.java:93)
    at junit.framework.TestCase.runBare(TestCase.java:130)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:120)
    at junit.framework.TestSuite.runTest(TestSuite.java:228)
    at junit.framework.TestSuite.run(TestSuite.java:223)
    at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
     
    author and iconoclast
    Posts: 24203
    43
    Mac OS X Eclipse IDE Chrome
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    In "classic" JUnit, tests are methods named as testXXX(). In JUnit 4, tests are methods marked with the @Test annotation. You've done neither of those things here.
     
    Jan Cumps
    Bartender
    Posts: 2653
    18
    Netbeans IDE C++ Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    sayTest() should be testSay().

    Regards, Jan
     
    Ranch Hand
    Posts: 35
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Jan Cumps wrote:sayTest() should be testSay().



    According to JUnit.org there is still a problem with JUnit 4.5
    and no answer has been posted under on JUnit.org

    Who knows the official forum concerning JUnit4.5? There is not much activity under JUnit.org.

    Best Regards
     
    Ernest Friedman-Hill
    author and iconoclast
    Posts: 24203
    43
    Mac OS X Eclipse IDE Chrome
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Jean-Claude Rouvinez wrote:

    Jan Cumps wrote:sayTest() should be testSay().



    According to JUnit.org there is still a problem with JUnit 4.5
    and no answer has been posted under on JUnit.org



    If you extend TestCase, use method names like testXXX(), and include the @Test annotations, then your tests work under JUnit 3, JUnit 4, and under some mysterious future version of JUnit in which extending TestCase doesn't pick up textXXX() methods, so I don't understand what that poster on that other site is on about. If he doesn't name his tests as testXxx(), then they don't work under JUnit 3, which is one of his goals.

    In any event, this is unrelated to what the poster did here, because this poster did not use annotations nor did he use textXXX() names.

    Also, PleaseDontWakeTheZombies.
     
    Greenhorn
    Posts: 20
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Everyone ,
    I had been looking for exactly the same kind of post and am so glad I found it. I'm facing a similar error while trying to run my junit testcase from a main class.
    Now, what I basically have to do is run a couple of junit test cases, one after the other to benchmark the performance of a service for different loads. When I run my main class, I get the following error :


    warning(junit.framework.TestSuite$1)junit.framework.AssertionFailedError: No tests found in AllTests
    at EvaluationBenchmarkingMain.main(EvaluationBenchmarkingMain.java:24)




    The following is my main class :



    The following is the AllTests class :




    And the following is the JUnit test class (Just one for now) , that I intend running from a separate project through the above main class:



    I also tried changing the name of the method to "testTC0008_PDSTest()" but that didnt help either.

    Please, Please help!!

    Thanks in advance,
    Ravissant
     
    Would you like to try a free sample? Today we are featuring tiny ads:
    Java file APIs (DOC, XLS, PDF, and many more)
    https://products.aspose.com/total/java
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!