Search

Dark theme | Light theme

November 19, 2009

Groovy Goodness: Running a Unit Test

If we create a unit test class extending GroovyTestCase we can run the test with the groovy command. This is a very easy way to execute a test.

class SimpleTest extends GroovyTestCase {
    void testGroovy() {
        assertEquals 'Run with groovy', 10, 5 + 5
    }
}

We can run this test with the following command:

$ groovy SimpleTest.groovy
.
Time: 0.125

OK (1 test)