phpunit.xml 用法
2015-09-21 19:41
686 查看
phpunit.xml 用法
分类: phpunit2012-06-3000:32 842人阅读 评论(0) 收藏 举报
测试actionjunitxmlloggingjson
<phpunit bootstrap="./booten.php">
<testsuite name="actionsuitetest">
<directory suffix=".php">action</directory>
<file>HuiyuanZhanghuOrder.php</file>
<exclude>/action/HuiyuanJifenTest.php</exclude>
</testsuite>
<testsuite name="modelsuitetest">
<directory suffix=".php">model</directory>
</testsuite>
<testsuite name="htmlsuitetest">
<directory suffix=".php">html</directory>
</testsuite>
<!-- 代码覆盖率 -->
<!-- 覆盖率的测试文件,blacklist 黑名单(不需要统计覆盖率的文件),whitelist 白名单(统计覆盖率的测试文件) 当黑名单与白名单文件重复时,白名单起作用
-->
<filter>
<blacklist>
<directory suffix=".php">action</directory>
<file>ArrayTest.php</file>
</blacklist>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">action</directory>
<directory suffix=".php">model</directory>
<directory suffix=".php">html</directory>
<file>ArrayTest.php</file>
<exclude>
<directory suffix=".php">action/lib</directory>
<directory suffix=".php">model</directory>
<file>action/lib/Loginxxx.php</file>
</exclude>
</whitelist>
</filter>
<!--代码覆盖率报告,可以生成很多类型报告,有html(coverage-html),xml(coverage-clover),txt ,json 等等
<log type="coverage-php" target="/tmp/coverage.serialized"/>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
<log type="json" target="/tmp/logfile.json"/>
<log type="tap" target="/tmp/logfile.tap"/>
<log type="junit" target="/tmp/logfile.xml" logIncompleteSkipped="false"/>
<log type="testdox-html" target="/tmp/testdox.html"/>
<log type="testdox-text" target="/tmp/testdox.txt"/>
-->
<logging>
<!-- target(report/html) 生成html 文件的目录-->
<log type="coverage-html" target="report/html" charset="UTF-8" yui="true" highlight="false" lowUpperBound="35" highLowerBound="70"/>
<!-- target(report/coverage/coverage.xml) 生成xml的文件名-->
<log type="coverage-clover" target="report/coverage/coverage.xml"/>
</logging>
<!-- 代码覆盖率 -->
<php>
<includePath>.</includePath>
<ini name="foo" value="bar"/>
<const name="foo" value="bar"/>
<var name="foo" value="bar"/>
<env name="foo" value="bar"/>
<post name="foo" value="bar"/>
<get name="foo" value="bar"/>
<cookie name="foo" value="bar"/>
<server name="foo" value="bar"/>
<files name="foo" value="bar"/>
<request name="foo" value="bar"/>
</php>
</phpunit>
xml 解释
bootstrap="./booten.php"
在测试之前加载的的PHP 文件,一般可以做一个初始化工作
<testsuite name="actionsuitetest">
<directory suffix=".php">action</directory>
<file>HuiyuanZhanghuOrder.php</file>
</testsuite>
测试套件,如果想测试页面,action,model 可以多加几个测试套件
name: 套件名称
directory :套件测试的目录,目录下一般放测试文件的用例
suffix :测试文件后缀,如果不填写,则默认后缀为*Test.php,即phpunit 默认会执行*Test.php 的文件
action:测试目录名
file:可以单独设置测试文件
exclude:排除不需要测试的文件
<php>
<includePath>.</includePath>
<ini name="foo" value="bar"/>
<const name="foo" value="bar"/>
<var name="foo" value="bar"/>
<env name="foo" value="bar"/>
<post name="foo" value="bar"/>
<get name="foo" value="bar"/>
<cookie name="foo" value="bar"/>
<server name="foo" value="bar"/>
<files name="foo" value="bar"/>
<request name="foo" value="bar"/>
</php>
这段xml 可以对应以下PHP 代码
includePath
ini_set('foo', 'bar');
define('foo', 'bar');
$GLOBALS['foo'] = 'bar';
$_ENV['foo'] = 'bar';
$_POST['foo'] = 'bar';
$_GET['foo'] = 'bar';
$_COOKIE['foo'] = 'bar';
$_SERVER['foo'] = 'bar';
$_FILES['foo'] = 'bar';
$_REQUEST['foo'] = 'bar';
phpunit.xml 应用网址http://www.phpunit.de/manual/3.6/en/appendixes.configuration.html#appendixes.configuration.blacklist-whitelist
版权声明:本文为博主原创文章,未经博主允许不得转载。
相关文章推荐
- [转]PHP7革新与性能优化
- CodeIgniter入口文件解析
- php $_POST提交无法输出的问题
- (一)Intellij output 中文乱码
- PHP几个函数pathinfo()、dirname()、basename()
- Decode error - output not utf-8
- 关于php读mysql数据库时出现乱码的解决方法
- 如何让PHP程序自动执行(后台)
- php图片上面写文字,输出图片
- QPS 与 TPS 简介
- PHP设计模式——适配器模式(Adapter)
- php判断今日是本月的第几个星期几
- 安装lamp之 一键安装php
- Weka-读懂TP Rate ,FP Rate, Precision, Recall, F-Measure, ROC Area,
- YII2的安装与配置
- Elasticsearch-PHP 安装
- php的安装及遇到问题解决方法
- php函数引用
- PHP
- 实用的php清除html,php去除空格与换行,php清除空白行和换行,提取页面纯文本