all classes handled as TestCase if name ends with Test

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

all classes handled as TestCase if name ends with Test

Marko Bauhardt-3
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 ;) )

---
  <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.AssertionFailedError:  
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