Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2447

Allow JUnit 4 tests to be run by the groovy command

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.5.2
    • None
    • None
    • Patch

    Description

      Groovy allows JUnit 3.8.x tests and GroovyTestCases to be invoked from the command line. It would be good to also support JUnit 4 tests in this way. The attached patch does this.

      Pros and Cons:
      It 'simply' saves the 'JUnitCore.main(MyTest.name)' added to the bottom of a script which manually invokes the runner. So we are adding code to the Groovy codebase for only a small saving
      It does allow the script to be left as a test class that IDEs would run using their runners and doesn't require them to be polluted with the JUnitCore manual runner code which makes no sense to a IDE runner
      Given that Groovy 1.5 is offering Java 1.5 support, it does round out nicely JUnit 4 support which is often used in the jump to Java 1.5 and hence improves the case for using Groovy as your testing language for Java 1.5 projects (e.g. making TDD and BDD easier out of the box)
      Are we showing favouritism vs other alternatives, e.g. TestNG
      We already have a testng runner but no direct JUnit runner

      I am happy to apply it but wanted to attach it here so that discussion can occur around whether it should be a 1.5.2 or 1.6 feature (or not included).

      Paul.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              paulk Paul King
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: