如何在 Perl 中进行单元测试? [英] How can I do unit testing in Perl?
问题描述
我一直在做一些面向对象的 Perl 编程,我想知道:执行单元测试的最佳方式是什么?
I have been doing some OO Perl programming and I was wondering: which is the best way to perform unit tests?
到目前为止,我一直在使用 Test::Simple 模块来执行测试,但是感觉不够我想要的.
So far I have been using the Test::Simple module to perform tests, but it feels insufficient for what I want.
你能为我指出一些不错的模块吗?
Can you point me to some nice modules for that?
推荐答案
我将投票加入Test::More
在进一步进行 Perl 测试之前.Perl 测试社区 与测试任何协议相当一致,你会想要玩弄Test::More
了解它的工作原理以及像 prove
和 Test::Harness::Archive
可以帮助自动化和分发测试.
I'd add my vote to picking up Test::More
before going any further in Perl testing. The Perl testing community is fairly well united around the Test Anything Protocol, and you'll want to play around with Test::More
to understand how it works and how tools like prove
and Test::Harness::Archive
can help automate and distribute testing.
如果你只想直接进入",我认为 Test::Class
为 xTest 工具提供 TAP 后端.我根本没用过(我是一个 Test::More
本人),但它评价很高.
If you want to just "jump right in", I think Test::Class
provides xTest facilities with a TAP backend. I haven't used it at all (I'm a Test::More
person myself), but it's very highly rated.
这篇关于如何在 Perl 中进行单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!