我有一个简单的测试套件,我一直在为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下运行在浏览器和命令行中。 –