Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JUnit : AssertionFailedError, tests not found in

Here is my testMethod in question,

public class DetailsTest extends TestCase
{
    public void testGetQuotes() throws Exception
    {
        int bookSize = getBookSize();
        List<Details> detailList = getDetailLists();
        assertNotNull(bookSize);
        assertEquals(bookSize, detailList.size());
        assertNotNull(detailList.size());
    }
}

My class extends JUnit : TestCase, not sure what is wrong in here that is causing the issue...am using junit 3.8.1

Update I have gone through similar questions on SO but it has not been very helpful.

Update 2 : StackTrace

1) warning(junit.framework.TestSuite$1)junit.framework.AssertionFailedError: No tests found in com.comp.Details.DetailsTest
    at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
    at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
    at junit.extensions.TestSetup.run(TestSetup.java:23)

FAILURES!!! Tests run: 1, Failures: 1, Errors: 0

Update 3: I just had Details class in my testSuite and not DetailsTest, fixed it and now it works fine...one of those days...you see...

like image 380
Rachel Avatar asked Mar 10 '26 01:03

Rachel


1 Answers

Are you calling addTestSuite

suite.addTestSuite(DetailsTest.class)

where you should be calling addTest

suite.addTest(DetailsTest.class)
like image 166
stevedbrown Avatar answered Mar 12 '26 13:03

stevedbrown



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!