我有一個簡單的測試套件,我一直在爲PHP中的一些最近的API封裝代碼編寫代碼。但每次運行測試時,它都會運行所有測試兩次。Simpletest正在運行我所有的測試兩次。爲什麼?
我的調用代碼:
require_once(dirname(__FILE__) . '/simpletest/autorun.php');
require_once('CompanyNameAPI.php');
$test = new TestSuite('API test');
$test->addFile(dirname(__FILE__) . '/tests/authentication_test.php');
if (TextReporter::inCli()) {
exit ($test->run(new TextReporter()) ? 0 : 1);
} else {
$test->run(new HtmlReporter());
}
authentication_test.php樣子:
class Test_CallLoop_Authentication extends UnitTestCase {
function test_ClassCreate(){
$class = new CallLoopAPI();
$this->assertIsA($class, CallLoopAPI);
}
//More tests
}
有沒有什麼更包括對autorun.php或其他電話要麼authentication_test.php內SimpleTest的。
想法?
我不是一個SimpleTest的大師,但我一直在閱讀文件和它說,你嘗試使用代碼,已經是嵌入在最簡單的庫中,這樣你的測試就會自動識別你的記者使用,以防你使用命令行或瀏覽器。我建議你的代碼實際上在適當的Reporter下運行在瀏覽器和命令行中。 –