Package cn. hxyh. cal. test;
Import junit. framework. TestCase;
Import cn. hxyh. cal. dao. CaculatorDAO;
Import cn. hxyh. cal. factory. CaculatorFactory;
Public class TestCaculator extends TestCase {
Public void TestAdd (){
CaculatorDAO ca = CaculatorFactory. getCaculatorDAO ();
Double result = ca. Add (3.5, 6.5 );
AssertEquals (10, result, 0 );
}
}
Bytes ---------------------------------------------------------------------------------------------------------------
Junit. framework. AssertionFailedError: No tests found in cn. hxyh. cal. test. TestCaculator
At junit. framework. Assert. fail (Assert. java: 47)
At junit. framework. TestSuite $1. runTest (TestSuite. java: 97)
At junit. framework. TestCase. runBare (TestCase. java: 134)
At junit. framework. TestResult $1. protect (TestResult. java: 110)
At junit. framework. TestResult. runProtected (TestResult. java: 128)
At junit. framework. TestResult. run (TestResult. java: 113)
At junit. framework. TestCase. run (TestCase. java: 124)
At junit. framework. TestSuite. runTest (TestSuite. java: 232)
At junit. framework. TestSuite. run (TestSuite. java: 227)
At org. junit. internal. runners. JUnit38ClassRunner. run (JUnit38ClassRunner. java: 81)
At org. eclipse. jdt. internal. junit4.runner. JUnit4TestReference. run (JUnit4TestReference. java: 38)
At org. eclipse. jdt. internal. junit. runner. TestExecution. run (TestExecution. java: 38)
At org. eclipse. jdt. internal. junit. runner. RemoteTestRunner. runTests (RemoteTestRunner. java: 460)
At org. eclipse. jdt. internal. junit. runner. RemoteTestRunner. runTests (RemoteTestRunner. java: 673)
At org. eclipse. jdt. internal. junit. runner. RemoteTestRunner. run (RemoteTestRunner. java: 386)
At org. eclipse. jdt. internal. junit. runner. RemoteTestRunner. main (RemoteTestRunner. java: 196)
Bytes -----------------------------------------------------------------------------------------------------------------
Solution: www.2cto.com
Modify the capitalized TestAdd () to testAdd (). If the method name is only Add, Add test before the method name.
From running snails