dimanche 18 septembre 2016

How does JUnit find tests?

I had assumed that JUnit found tests (inside classes derived from junit.framework.TestCase) by looking for methods annotated with @Test. However, I've included a test from http://ift.tt/2cVdRaL in a project. The structure of the code is as follows:

import junit.framework.TestCase;

public class JenkinsHashTest extends TestCase {
    public void testHashes() {
        ...//this code is run
    }   
}

I have confirmed that the test method testHashes() is run despite not being annotated with @Test. In case it's relevant, I'm invoking all of this via gradle test.

Aucun commentaire:

Enregistrer un commentaire