测试命令行工具的最佳方法? [英] Best way to test command line tools?
问题描述
我们有大量自己编写并经常使用的命令行实用程序.目前,测试它们非常麻烦,因此,我们没有尽可能多地进行测试.
We have a large collection of command-line utilities that we write ourselves and use frequently. At the moment, testing them is very cumbersome and consequently, we don't do as much testing as we aught to.
我想知道是否有人可以推荐好的技术或工具来做好这种事情.
I am wondering if anyone can suggest good techniques or tools for doing a good job of this kind of thing.
这是 UNIX.
推荐答案
Aruba 是一个 Cucumber 扩展,用于测试用任何编程语言编写的命令行应用程序.
Aruba is a Cucumber extension for testing command line applications written in any programming language.
要使用它,您将需要 ruby 来运行测试,但 aruba 的目的是提供一个预定义步骤定义的库,这样您就不需要编写任何 ruby 代码来制作一个可行的测试套件.(尽管在某些时候您可能需要编写一些 ruby 来制作一些自定义步骤.)
To use it, you will need ruby to run the tests, but the purpose of aruba is to provide a library of pre-defined step definitions so that you won't need to write any ruby code to make a workable test suite. (Though at some point you probably will want to write a bit of ruby to make a few custom steps.)
您可以在此处查看使用 Aruba 测试的命令行工具的复杂示例:jingweno/嗯
You can see a sophisticated example of a command line tool tested with aruba here: jingweno/gh
这篇关于测试命令行工具的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!