DISQUS

Mat Schaffer: Groovy Unit Tests on Maven & Eclipse

  • Rick R · 9 months ago
    I'm having a bitch of time getting this to work correctly. I'm running into classpath issues so I'm wondering what I'm doing wrong. I have my test groovy code under src/test/groovy and my main groovy under scr/main/groovy. Without the configuration setup for the gmaven plugin, my standard groovy and java code complies just fine - it's just getting the tests under src/test/groovy to work correctly. It's as if it doesn't recognize the classpath at all (it first barfs jon "org.testng.annotations does not exist" - mind you the regular java tests work fine once I remove the configuration for gmvaen, it's only getting these groovy tests to work.)

    I posted what I think should be my relevant pom information here
    http://pastie.org/406377

    Any tips much appreciated.
  • Mat Schaffer · 9 months ago
    I haven't tried the testng groovy integration. All my tests extend groovy.util.GroovyTestCase which I believe is JUnit by definition. I would expect that for TestNG tests to work correctly you'll need to include TestNG as a dependency in your pom.

    Also I had a lot of issues getting groovy tests to work in eclipse until I started putting them under src/test/java. But gmaven worked regardless of where the tests were.
  • Rick R · 9 months ago
    Thanks Mat for replying. For now I switched to JUnit (and using Guice as well) and things are fine.

    I'm currently not extending groovy.util.GroovyTestCase, just using AtUnit from Guice.. and it works pretty nicely.)

    Thanks again. Eventually I'll get it working with TestNG, but for now JUnit is fine.
  • Mat Schaffer · 9 months ago
    Glad I could help! I might have to give Guice a try too.