当我试图在JUnit4中运行测试代码时,在终端中遇到了这个错误。但是,我的测试代码都通过了,但是终端上也显示了失败的错误,我不明白。
注意:这个junit类中只测试callstack.java
> Task :test FAILED
DSAQueue > initializationError FAILED
java.lang.IllegalArgumentException: Test class can only have one constructor
DSAStack > initializationError FAILED
java.lang.IllegalArgumentException: Test class can only have one constructor
EquationSolver > initializationError FAILED
java.lang.Exception: No runnable methods
CallStack > initializationError FAILED
java.lang.Exception: No runnable methods
DSAShufflingQueue > initializationError FAILED
java.lang.IllegalArgumentException: Test class can only have one constructor
DSACircularQueue > initializationError FAILED
java.lang.IllegalArgumentException: Test class can only have one constructor
JUnitTest > testStack PASSED
JUnitTest > testShufflingQueue PASSED
JUnitTest > testEquationSolver PASSED
JUnitTest > testCircularQueue PASSED
10 tests completed, 6 failed
我的测试课是这样开始的。
import org.junit.*;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import static org.junit.Assert.*;
import java.io.*;
@RunWith(JUnit4.class)
public class JUnitTest
{
@Test
public void testStack()
{
/* test code */
}
@Test
public void testShufflingQueue()
{
/* test code */
}
@Test
public void testCircularQueue()
{
/* test code */
}
@Test
public void testEquationSolver()
{
/* test code */
}
}
暂无答案!
目前还没有任何答案,快来回答吧!