意图使用内置于CodeIgniter的单元测试 [英] Intended use of the Unit Testing built in to CodeIgniter

查看:220
本文介绍了意图使用内置于CodeIgniter的单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在大多数框架单元测试实现中,您有一组测试,并从单个[console]命令执行这些测试。测试运行并给出结果。这种结果不尽相同,但通常包括通过/失败。

In most framework unit testing implementations, you have a set of a tests and you execute those tests from a single [console] command. The tests run and a result is given. That result varies but generally it includes pass / fail.

CodeIgniter的单元测试框架看起来不同,我注意到了大量的随机粘贴项目,替换CodeIgniter单元测试框架。

CodeIgniter’s unit testing framework appears different and I have noticed an extensive collection of random tack-on-projects to either enhance or replace the CodeIgniter unit testing framework.

我的问题是这个:预期的工作流程或单元测试框架的使用是什么内置的CodeIgniter?

My question is this: What is the intended work flow or use of the unit testing framework built in to CodeIgniter?

我阅读了文档;我知道了。这是一个简单的类。但是,在哪里使用类呢?

I read the documentation; I get it. It’s a simple class. But where does one utilize the class?

例如,所有的测试都进入一个单独的测试控制器?或者测试混合到每个控制器?然后有模型和自定义助手的问题...另外,我假设测试是通过浏览器(或类似的)请求运行...

For example, do all the tests go in to a single "test" controller? Or do the tests get intermingled in to each controller? Then there is the question of the models and custom helpers... Also, I'm assuming tests are run via a browser (or the alike) request...

感谢您的指导!

回复,

Frank

Regards,
Frank

推荐答案

我收到了来自另一个来源,我想张贴在这里,因为我知道它。

I've received an answer from another source and I want to post it here since I am aware of it.

基本的答案是CI(CodeIgniter)单元测试类不是像传统的单元测试套件(JUnit,NUnit或python的unittest)。在CI中,类旨在在目标(测试目标的代码库)内使用。

The basic answer is that the CI (CodeIgniter) unit test class is not intended like a traditional unit test suite (JUnit, NUnit, or python's unittest). In CI, the class is intended to be used within the target (the testing target's code base).

要清楚:我不会同意这一点,也不能确定这 CI的预期用途 unit_test class 。这正是我被告知的。也许别人听到这个也可以投票。如果这是投票或通过评论的支持,我会将此标记为答案。我仍然对不同的意见感兴趣。

To be clear: I'm not endorsing this nor am I sure this is the intended use of the CI unit_test class. This is just what I was told thus far. Perhaps others heard this too and can vote it up. If this is voted up or has support via comments, I'll mark this as an answer. I am still interested in differing opinions.

这篇关于意图使用内置于CodeIgniter的单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆