为 Dist::Zilla 铸造模块编写测试
是时候为 Dist::Zilla::Plugin 编写功能测试了: :催化剂。但我意识到我不知道从哪里开始。我知道我必须有一个由我的测试套件识别的自定义铸造配置文件,并且我可能只会进行测试以确保所有正确的文件都以合适的权限输出。我完全不确定您使用什么 DZ 模块来包含铸币配置文件,或者如何启动铸币,然后检查输出(因为我怀疑它将使用临时目录)。
有人能给我一些指点吗?还有其他有测试的铸币模块吗?
It's about time I wrote a functionality test for Dist::Zilla::Plugin::Catalyst. But I realized that I haven't a clue on where to start. I know that I have to have a custom minting profile recognized by my test suite, and that I'm probably going to just test to make sure that all the right files are output with suitable perms. I'm not at all sure what DZ module to you use for including the minting profile, or how to then start a mint, and then check the output ( because I suspect that it's going to use a temp directory ).
Could someone give me some pointers? are there any other minting modules, that have tests?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是铸币者的一个非常基本的测试文件。
当然,对于许多真正的测试,您还需要阅读创建的文件。这可以通过
$tzil->slurp_file('file');
来完成。测试铸造的 dist 与常规 Dist 没有太大区别::Zilla::Tester 测试,所以您可能希望阅读我在 编写一个简单的 Dist::Zilla::Tester 测试。
Here's a very basic Test file for a minter.
of course for many a real test you'll also want to read the minted files. This can be done with
$tzil->slurp_file('file');
.Not much is different for testing a minted dist from a regular Dist::Zilla::Tester test, so you might wish to read the blog I wrote on writing a simple Dist::Zilla::Tester test.
官方 Dist::Zilla 教程 现在有 有关编写和测试新插件的页面。这涵盖了一般的插件,而不是专门的铸造插件,但是对于铸造插件来说没有什么特别或不同的地方。您可以按照建议查看
t/minter.
,看看它有多相似。Test::DZil
现在随 Dist::Zilla 一起提供并安装以供其他插件使用,我用它来测试所有非核心插件。The official Dist::Zilla tutorial now has a page on writing and testing new plugins. This covers plugins in general, not minting plugins specifically, but there's nothing particularly special or different about doing it for minting plugins. You can see
t/minter.
, as suggested, to see just how similar it is.Test::DZil
is now shipped with Dist::Zilla and installed for use by other plugins, and I use it for testing all my non-core plugins.