You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2015/06/23 12:18:00 UTC

[jira] [Commented] (GROOVY-7406) AntBuilder can't run a pure JUnit4 task, whereas Ant can do

    [ https://issues.apache.org/jira/browse/GROOVY-7406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14597442#comment-14597442 ] 

Paul King commented on GROOVY-7406:
-----------------------------------

Just as a side test, you can run a JUnit4 suite as a Groovy script as follows:
{code}
import org.junit.runner.RunWith
import org.junit.runners.Suite
import org.junit.Test

@RunWith(Suite)
@Suite.SuiteClasses(MyTest)
class SuiteMarker{}

class MyTest {
    @Test
    void myTest() {
        assert true
    }
}
{code}


> AntBuilder can't run a pure JUnit4 task, whereas Ant can do
> -----------------------------------------------------------
>
>                 Key: GROOVY-7406
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7406
>             Project: Groovy
>          Issue Type: Bug
>          Components: Ant integration
>    Affects Versions: 2.4.3
>            Reporter: Gert Großmann
>
> If you have a pure JUnit4 test suite with @RunWith(Suite.class) and @Suite.SuiteClasses({ ... }) and try to execute this via AntBuilder() no tests can be executed because it states 'No tests found in ...'
> An equivalent Ant 1.9.4 <junit> task with the same compiled test suite finds the tests.
> I didn't had the issue with Groovy 2.1.7. But it seems this version added a suite() method with a JUnit4TestAdapter.
> If you add
> {code}
> public static Test suite() { return JUnit4TestAdapter(<testclass>)}
> {code}
> to your test suite everything works fine even in Groovy 2.4.3.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)