Hi Marko,

On Jul 3, 2008, at 10:04 AM, Marko Bauhardt wrote:

Hi all,
i have a curious junit test error.
for example: i have a normal class that extends from TestCase. This class has a inner interface with name ITest.


---
public class MY_TEST_CLASS extends TestCase {

    interface ITest {
        String testMethod();
    }

....

}
---

So in my build.gradle i have included all classes with suffix *Test

---
test {
  include '**/*Test.class'
}
---

if i execute this i get a testFailure that the class ITest has no public constructur. (but ITest is an interface and no class ;) )

I guess this is a pecularity of the Ant JUnit task. The task perspective is to try to execute all classes as Unit tests that obey to the pattern, and throw an exception if it does not work. What exactly the Ant task is trying to do with the interface class I don't know. But excluding it is the way of dealing with this. The same would be necessary when executing the tests from an Ant script.

Thanks

- Hans


---
<testcase classname="junit.framework.TestSuite$1" name="warning" time="0.0050"> <failure message="Class MY_TEST_CLASS$ITest has no public constructor TestCase(String name) or TestCase()" type="junit.framework.AssertionFailedError">junit.framework.AssertionF ailedError: Class MY_TEST_CLASS$ITest has no public constructor TestCase(String name) or TestCase()
</failure>
  </testcase>
---

but anyway. i exclude this interface in the test task


---
test {
  include '**/*Test.class'
  exclude '**/*ITest*'
}
---

So i think also all Interfaces with suffix 'Test' are handled as TestCase. Also i have created a temporary class with name 'FooTest' in my testSrcFolder. This class do not extend from TestCase but this class is handled as TestCase and will be execute with junit.

Marko








---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to