Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.5.7, 1.6-beta-2
-
None
-
Microsoft Windows XP [Version 5.1.2600]
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Groovy Version: 1.5.6 JVM: 1.5.0_04-b05
Description
Groovy runs a class as a testNG test only if at least one method is annotated with org.testng.annotations.Test. If the @Test annotation is only done at the class level, the class is not recognized as a TestNG test class.
I looked into it and found that org.codehaus.groovy.vmplugin.v5.TestNgUtils.realIsTestNgTest() checks only method level annotations) to determine if a class can be run as a TestNG test class.
Example code:
import org.testng.annotations.Test; @Test class GroovyTest { void willPass() { assert 1 == 1 } }
The code above fails with following error:
Caught: groovy.lang.GroovyRuntimeException: This script or class could not be run. It should either: - have a main method, - be a JUnit test, TestNG test or extend GroovyTestCase, - or implement the Runnable interface.
regards,
Roshan