如何在PHP中进行集成测试? [英] How to perform integration testing in PHP?

查看:212
本文介绍了如何在PHP中进行集成测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在我的code(使用PHPUnit的詹金斯)执行单元测试,但我已经读了很多关于集成测试。

I am currently performing unit tests on my code (using PHPUnit and Jenkins) but I have read a lot about integration testing.


  • 有没有在PHP中执行此任何工具(preferably自动化)?

  • Are there any tools to perform this in php (preferably automated)?

我如何去实施呢?
是否有良好的教程
地方?

How would I go about implementing it? Are there any good tutorials anywhere?

推荐答案

基本上走的路是除了单元测试还模拟测试这并不仅仅测试单个单元更喜欢,你看到聚集在一起的一组单位落实他们为这应该表现在以某种方式,而在交给一些投入或调用方法的逻辑单元。

Basically the way to go is to implement besides unit tests also mock tests which are not solely testing a single unit more like a group of units bunched together and you see them as a logical unit which should behave in a certain way while handing in some input or calling methods.

这其中的一个可能的库 yaymock 在谷歌code库。它是一种模拟PHP5库。

One possible library for this is yaymock in the google code repository. Its a php5 mock library.

此外集成测试都或多或少仅其中测试完整的系统行为测试。基本的事情是设置一个测试环境和事后部署应用程序。你可以做这样的测试,还与单元测试框架,或者是模拟库。如你所愿。详细集成测试你的情况是HTTP请求,根据您的数据库和预期可能的HTML输出一些数据。

Further integration tests are more or less only tests which test the complete system behavior. The basic thing is setting a test environment up and deploy your application afterwards. You can do this kind of testing also with a unit test framework or a mock library. As you wish. Integration tests in detail in your case are http requests, based on some data in your database and an expected possible "html" output.

要自动执行此,你可以使用一些持续集成框架......无论是哈德森,Arbit或phpUnderControl。有关设置PHP和哈德森和一些不错的测试插件有一个pretty良好的教程。它还提到了一些有用的插件,像code-覆盖率检查,等等。这可以在环境中进行整合。

To automate this you can use some continous integration frameworks... either Hudson, Arbit or phpUnderControl. For setting up php with hudson and some nice testing plugins there is a pretty good tutorial. It mentions also some useful plugins like Code-Coverage checks, etc ... which could be integrated inside the environment.

这篇关于如何在PHP中进行集成测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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