Netbeans-PHPUnit quot;No tests executedquot; error(Netbeans-PHPUnit “未执行测试错误)
问题描述
我是任何测试的新手.我刚刚使用这个 安装了 pear 和 PHPUnit文档.我使用 netbeans 7.3.1.我还安装了运行此命令的 skeletongenerator
:pear install phpunit/PHPUnit_SkeletonGenerator
.
I am newbie to any kind of testing. I just installed pear and PHPUnit using this doc. I use netbeans 7.3.1. I also installed skeletongenerator
running this command : pear install phpunit/PHPUnit_SkeletonGenerator
.
我按照此使用 PHPUnit 进行测试 将 PHPUnit 集成到 netbeans.
如该文档的 Installing PHPUnit
部分所述,通过单击 Netbeans->preferences->unit testing
下的 search
按钮,我的 netbeans 可以识别 PHPUnit安装.
I Followed the steps listed in this testing with PHPUnit to integrate PHPUnit to netbeans.
As described in Installing PHPUnit
section of that doc, by clicking search
button under Netbeans->preferences->unit testing
my netbeans recognizes PHPUnit installation.
我按照所有步骤添加示例 Calculator
项目并生成测试类.我这样做了.但是当我通过右键单击 Calculator.php 文件并选择 Test
运行测试时,我得到以下结果.
I followed all the steps to add sample Calculator
project and generate test class. I did that. But when I run the tests by right clicking Calculator.php file and selecting Test
I get following result.
输出窗口没有显示任何有用的信息:
Output window shows nothing useful :
我不知道可能是什么问题以及如何解决.
I have no idea of what can be the problem and how to solve that.
可能导致上述问题的几个疑点:
我应该在 Netbeans->preferences->general
下的 Global include path
中添加什么?
我需要在 Calculator.php 文件中添加 require_once
语句吗?
我是否需要仅在某个特定文件夹下创建 php 项目,或者我放置项目的位置无关紧要?
如何检查 PHPUnit 是否已正确安装并正常工作?
Few doubts that may be causing the above problem :
What should I add in Global include path
under Netbeans->preferences->general
?
Do I need to add require_once
statement in Calculator.php file?
Do I need to create php projects under some particular folder only or is it immaterial where I place projects?
How do I check that PHPUnit is installed properly and is working?
可能还有很多我想不出来的症状.
There can be many other symptoms that I am not even able to think of.
谢谢.
推荐答案
通过在 Calculatortest.php
文件中添加以下行来解决.
Solved by adding below line to Calculatortest.php
file.
require_once dirname(__FILE__) . '/../Calculator.php';
测试类放在一个子目录下,所以我需要声明相对于Calculator.php的路径.
The test class is placed in a subdirectory, so I needed to declare the path relative to the Calculator.php.
另外,我必须更改 php.ini 文件,以便在出现错误时显示错误.
我在 php.ini 中设置了以下变量.
Also, I had to change php.ini file so that errors are displayed in case there are.
I set following variables in php.ini.
error_reporting = E_ALL | E_STRICT
display_errors = On
这篇关于Netbeans-PHPUnit “未执行测试"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Netbeans-PHPUnit “未执行测试"错误
基础教程推荐
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01