php - 使用 Eclipse SimpleTest 插件 - SimpleTest 不工作

标签 php eclipse unit-testing simpletest

我正在使用 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 :

  1. download并安装 SimpleTest
  2. 在测试文件的顶部放一个 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 甚至可能不必更改测试文件.

  3. 通过右键单击测试文件并选择“Run As PHP Script”来运行测试
  4. 测试的输出显示在 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/

相关文章:

c# - 尝试从资源目录访问图像时出现 XamlParseException

Android单元测试——解决&验证问题

php - 我如何从下表中选择不同的行

java - HTTP 状态 404 - 在带有 Tomcat 的 Eclipse 上(没有生成 web.xml)

php - 如何加快我的 PHP 包含速度?

eclipse - 如何让我的 Maven Junit 测试打印出与 Eclipse JUnit 生成的相同的堆栈跟踪?

java - Eclipse 无法构建

javascript - 在 jest.mock(moduleName,factory) 工厂函数中模拟多个命名导出

php - 我怎样才能得到一个电话号码,客户可以通过短信将信息发布到我的网站上?

php - MYSQL PHP 在textarea中保存换行符以备后用