我正在使用 Eclipse 3.4.2 并使用 Help>Software Updates... 安装了最新的 simpletest 插件
插件安装正确,我可以在 Window>Preferences>SimpleTest 中设置它。 我填写了以下字段:Php.exe 文件、php.ini 文件和测试文件后缀。我找不到最简单的路径(甚至不在 Eclipse 插件文件夹中)。
我认为此配置是正确的,并运行了在 simpletest eclipse 站点上找到的第一个测试:http://simpletest.sourceforge.net/en/extension_eclipse.html
<?php
class test1 extends UnitTestCase {
function test_pass(){
$x = 1;
$y = 2;
$total = $x + $y;
$this->assertEqual(3,$total, "This should pass");
}
}
?>
我一直按照所有说明进行操作,但是当我右键单击并选择 RUN AS>SimpleTest 时,没有任何反应。
我需要一些帮助。
谢谢!
最佳答案
according to the author最简单的插件,
the plugin has outlived it usefulness (or rather the toolset can now more easily provide the functionality).
他本人是not using it anymore. instead, he uses the following procedure :
- download并安装 SimpleTest
在测试文件的顶部放一个
require_once('autorun.php');
注意:这需要包含
autorun.php
的 SimpleTest 目录位于您的include_path
中.或者,您可以通过完整路径包含autorun.php
,例如require_once('C:/full/path/to/your/Simpletest/autorun.php');
。通过auto_prepend_file
包含autorun.php
甚至可能不必更改测试文件.- 通过右键单击测试文件并选择“Run As PHP Script”来运行测试
- 测试的输出显示在 eclipse 控制台中
根据作者的说法,
this is easier to configure and it runs faster than the plugin. The other benefit of running this way is that if you want to debug your test, when you right click the test file you can click "Debug As PHP Script" instead of "Run As".
关于php - 使用 Eclipse SimpleTest 插件 - SimpleTest 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1474483/