php单元测试/涉及代码覆盖率——netbeans工具
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php单元测试/涉及代码覆盖率——netbeans工具,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2591字,纯文字阅读大概需要4分钟。
内容图文
1.入门
https://netbeans.org/kb/trails/php_zh_CN.html
NetBeans是开源软件开发集成环境,是一个开放框架,可扩展的开发平台,可以用于Java、C/C++,PHP等语言的开发,本身是一个开发平台,可以通过扩展插件来扩展功能。
2.搭环境
软件,插件等参照 文件中的NetBeans.rar
前提:wamp server环境OK
准备谷歌自由版(netbeans插件ok)
a.首先必须先安装jdk-8u40-nb-8_0_2-windows-x64.exe
b.安装netbeans-8.0.2-windows.exe
c.将以下3个插件放在wamp\bin\php\php5.5.12 目录中
更新wamp\bin\php\php5.5.12\zend_ext\php_xdebug的dll文件版本
d.设置电脑环境变量
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.auto_trace=1
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.trace_output_dir="d:/wamp/xdebug/trace"
xdebug.profiler_enable=1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir="d:/wamp/xdebug/profiler"
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of Sample
*
* @author sicnco
*/
class Sample {
//put your code here
public function Get($a)
{
if($a==1)
{
return ‘ok:‘.$a;
}
else
{
return ‘ng:‘.$a;
}
}
}
require_once ‘../test.php‘; <------这一行需要手动添加
/**
* Generated by PHPUnit_SkeletonGenerator on 2015-03-27 at 03:50:41.
*/
class SampleTest extends PHPUnit_Framework_TestCase {
/**
* @var Sample
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
$this->object = new Sample;
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown() {
}
/**
* @covers Sample::Get
* @todo Implement testGet().
*/
public function testGet() {
$rlt = $this->object->Get(1); <----需要写代码,验证
$this->assertEquals($rlt, ‘ok:1‘); <----验证代码运行结果
}
}
原文:http://www.cnblogs.com/nimezi/p/4371577.html
内容总结
以上是互联网集市为您收集整理的php单元测试/涉及代码覆盖率——netbeans工具全部内容,希望文章能够帮你解决php单元测试/涉及代码覆盖率——netbeans工具所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。