简体   繁体   English

如何将QUnit测试集成到Yii中

[英]How to integrate QUnit tests into Yii

I have a Yii project that is starting to rely more heavily on javascript for a lot of its operation. 我有一个Yii项目,它开始更多地依赖于javascript来进行大量的操作。

To achieve a decent level of test coverage I'd like to use QUnit to test the javascript. 为了达到相当水平的测试覆盖率,我想使用QUnit来测试javascript。 Much of the javascript relies on ajax calls to pick up data from models (eg lists of items in drop downs). 许多javascript依赖于ajax调用来从模型中获取数据(例如,下拉列表中的项目列表)。

I'd like to be able to use my Yii fixtures to set the database to a known state before running the QUnit tests - does anyone know of a way to make this happen? 在运行QUnit测试之前,我希望能够使用我的Yii灯具将数据库设置为已知状态 - 有没有人知道如何实现这一点? Or can anyone suggest another javascript unit testing framework that works well with Yii? 或者任何人都可以建议另一个与Yii一起使用的javascript单元测试框架?

I would take a look at Venus (www.venusjs.org). 我想看看维纳斯(www.venusjs.org)。 It works with QUnit (and other test libraries) and may give you something close to what you are looking for. 它适用于QUnit(和其他测试库),可能会给你一些接近你正在寻找的东西。 If you have questions, I'd be happy to work with you. 如果您有任何疑问,我很乐意与您合作。 Disclaimer: I am the creator of Venus. 免责声明:我是维纳斯的创造者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM