PHP 中的测试驱动开发 [英] Test Driven Development in PHP

查看:28
本文介绍了PHP 中的测试驱动开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名使用 PHP 的网络开发人员.我在 C# 桌面应用程序中使用测试驱动开发的经验有限.在那种情况下,我们使用 nUnit 作为单元测试框架.

I am a web-developer working in PHP. I have some limited experience with using Test Driven Development in C# desktop applications. In that case we used nUnit for the unit testing framework.

我想在新项目中开始使用 TDD,但我真的不知道从哪里开始.

I would like to start using TDD in new projects but I'm really not sure where to begin.

对于基于 PHP 的单元测试框架,您有什么建议?对于刚接触 TDD 概念的人来说,有哪些好的资源?

What recommendations do you have for a PHP-based unit testing framework and what are some good resources for someone who is pretty new to the TDD concept?

推荐答案

我用过 PHPUnit &SimpleTest 我发现 SimpleTest 更易于使用.

I've used both PHPUnit & SimpleTest and I found SimpleTest to be easier to use.

就 TDD 而言,从最纯粹的意义上说,我没有太多运气.不过,我认为这主要是我的时间/纪律问题.

As far as TDD goes, I haven't had much luck with it in the purest sense. I think that's mainly a time/discipline issue on my part though.

事后添加测试有点有用,但我最喜欢做的事情是使用编写 SimpleTest 测试来测试我必须修复的特定错误.这样就可以很容易地验证事情是否确实已修复并保持不变.

Adding tests after the fact has been somewhat useful but my favorite things to do is use write SimpleTest tests that test for specific bugs that I have to fix. That makes it very easy to verify that things are actually fixed and stay fixed.

这篇关于PHP 中的测试驱动开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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