lolex
lolex

Reputation: 65

JUnit test error No test found

I used JUnit 3 and when I wrote this code I got this error

AssertionFailedError : No test Found

import junit.framework.TestCase;
import junit.runner.*;

public class Teststd extends TestCase {
    Student s;

    public void setUp() {
        s = new Student("ASJFA");
    }

    public void TestEmail() {
        try {
            s.setEmail("KUKU");
            assertTrue(false);
        } catch (EmailIsInvalid ex) {
            assertTrue(true);
            System.out.println("Exception caught. Email is invalid");

        }
    }

    public void tearDown() {
    }
}

Upvotes: 0

Views: 576

Answers (1)

Kai Sternad
Kai Sternad

Reputation: 22840

Your test method should start with a lowercase t. It should be public void testEmail(). Then it will be picked up by JUnit.

Upvotes: 6

Related Questions