phpunit.xml 用法
来源:互联网 发布:c用什么软件编程 编辑:程序博客网 时间:2024/05/16 04:38
phpunit.xml 用法
<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>
<!-- 代码覆盖率 -->
<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
版权声明:本文为博主原创文章,未经博主允许不得转载。
- phpunit.xml 用法
- phpunit.xml 用法
- PHPunit用法和xml文件
- PHPUnit学习笔记(二)PHPUnit基本用法
- PHP教程:PHPUnit学习笔记(二)PHPUnit基本用法
- PHPunit
- phpunit
- PHP单元测试利器:PHPUNIT深入用法(二)
- xml用法
- 安装PHPUnit
- PHPUnit+HTMLRunner
- PHPUnit系列
- PHPUnit安装
- phpunit是什么?
- PHPUnit manual
- PHPUnit 安装
- phpunit ubuntu
- phpunit - selenium
- MVC导入
- 【Html5】使Canvas适应不同设备
- 笔记:基于Netflow的网络流量工程
- block回调中调用方法的UI更新问题
- android-5.0 sensor工作原理—Sensor APP数据的获取
- phpunit.xml 用法
- matlab学习之数组学习
- POJ-1704(Georgia and Bob)——博弈论、SG函数
- HDU 3276 Graph and Queries [离线+并查集+treap]
- Android基础入门教程——2.4.6 ListView的数据更新问题
- UI03_LTView
- 猫猫学iOS 之BLOCK的妙用_利用block实现链式编程
- 重造轮子-sqrt
- Ajax 完整教程1