ZipException when running junit tests

后端 未结 2 919
挽巷
挽巷 2021-01-12 06:51

I\'ve been trying in vain to get ant to execute some tests written in junit. Any advice would be much appreciated. I\'m pretty new to both ant and Java so please be patient.

相关标签:
2条回答
  • 2021-01-12 07:38

    I'm assuming you're running jUnit 3. You may want to try creating a TestCase class that isn't abstract class. Also, have a default constructor or else jUnit won't know how to create the test class.

    In your case it should be:

    package testmanagment; 
    
    import junit.framework.*;
    
    public class EasyTest extends TestCase {
    
        public EasyTest() {
            super("Easy Test");
        }
    
        public void setUp() {
        }
    
        public void testSeeMee() throws Exception {
            assertTrue(true);
        }
    
        public void testSeeMeetoo() throws Exception {
            assertTrue(true);
        }   
    }
    
    0 讨论(0)
  • 2021-01-12 07:49

    You added EasyTest.class as a JAR file to the classpath. This doesn't work. Class files aren't JAR archives, so the classloader throws an error when it tries to load classes from it.

    0 讨论(0)
提交回复
热议问题