【问题标题】:Using Eclipse SimpleTest plugin - SimpleTest not working使用 Eclipse SimpleTest 插件 - SimpleTest 不起作用
【发布时间】:2010-12-01 06:17:51
【问题描述】:

我正在使用 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 时,没有任何反应。

我需要一些帮助。

谢谢!

【问题讨论】:

    标签: php eclipse unit-testing simpletest


    【解决方案1】:

    according to the author最简单的插件,

    插件已经过时了(或者说工具集现在可以更轻松地提供功能)。

    他本人是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 控制台中

    再次根据作者的说法,

    这更容易配置,运行速度比插件快。以这种方式运行的另一个好处是,如果你想调试你的测试,当你右键单击测试文件时,你可以点击“Debug As PHP Script”而不是“Run As”。

    【讨论】:

      【解决方案2】:

      您需要下载应用程序代码。

      看看 http://www.thetricky.net/php/php-unit-testing-in-eclipse

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2010-09-07
        • 2012-07-13
        • 2013-05-02
        • 2013-10-30
        • 1970-01-01
        • 2011-07-25
        • 1970-01-01
        相关资源
        最近更新 更多