kevin11 发表于 2013-3-9 23:43:05

Codeigniter与simeplotest初步试探

本帖最后由 kevin11 于 2013-3-9 23:43 编辑

codeigniter本身有自带的unit_test,但太简单了,
目前单元测试使用比较多的是 simpletest 和phpuint,
下载地址:
https://github.com/ericbarnes/codeigniter-simpletest
这个包可以直接使用。
使用说明在下载下面也有。我就不重复说了。
只展示一下我自己写的一个函数测试吧。
我在test/controll里面写一个test.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Created by JetBrains PhpStorm.
* User: Administrator
* Date: 13-3-9
* Time: 下午10:03
* To change this template use File | Settings | File Templates.
*/
class Test extends CodeIgniterUnitTestCase
{
    public function __construct()
    {
      parent::__construct('test controll');
    }
    public function test1()
    {
      $this->assertEqual(11,11);
    }
}
===========
http://codeigniter.org.cn/forums/data/attachment/album/201303/09/234112x2bdu9hublc3zd31.jpg


aizeroth 发表于 2013-6-24 18:29:53

我的为什么执行不成功呢,访问~/unit_test.php 啥也没有,unit_test_xml.php也是一样什么都没有,求楼主支招:(

aizeroth 发表于 2013-6-25 09:50:30

原来是要用Pear库,装好后就可以了

kevin11 发表于 2013-8-12 12:25:09

{:soso_e179:}

RedSquirrel 发表于 2013-9-16 16:57:46

感謝分享~~還蠻好用的,起碼比CI自帶的好用:D
页: [1]
查看完整版本: Codeigniter与simeplotest初步试探