- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在寻找一个测试框架来为 a language without much test support 引入自动化测试.据我所知,我需要一个能够使用某种形式的协议(protocol)运行 VDF 测试的框架。我宁愿把时间花在编写测试上,也不愿花时间编写 VDF 代码来与测试框架交互,因此更喜欢轻量级协议(protocol)。
Slim with Fitnesse似乎是个不错的候选人,但我对所有推荐感兴趣。
能够跨编程语言使用相同的测试框架将是一个额外的好处。
最佳答案
这假设您在 API 级别工作。如果我读错了,而你在 GUI 级别工作,你更倾向于考虑像 selenium 或 watir 这样的东西。
您是否考虑过编写自己的简单测试框架来输出 TAP 结果(测试任何协议(protocol))- 然后使用 grind 或 TAP2HTML 对其进行解析?
说真的,TAP 输出看起来像这样:
1..7ok 1 - hello world with null value returns 'hello world' stringok 2 - hello world with bob returns 'hello, bob'ok 3 - hello world with 123 return 'hello, 123'ok 4 - hello world with 5K string return hello plus stringok 5 - special charactersok 6 - internationalization, frok 7 - internationalization, jaLooks like you failed 0 tests of 7.
(如果它在第 5 步后死了,1..7 会告诉你有问题)
输出是直接的 ASCII。你基本上有两个全局变量,numTestsTotal 和 numTestExecuted,并像这样编写函数:
sub ok (boolean bExpected, string comment) { if (bExpected) { print "ok " . numTestsExecuted . " " . comment . "\n"; }else { print "not ok" . numTeststotal . " " . comment . "\n"; } numTestsExecuted++;}sub eq(int iExpected, int iResult, string comment) { if (iExpected==iResult) { print "ok " . numTestsExecuted . " " . comment . "\n"; } else { print "not ok" . numTestsExecuted . " " . comment . \n"; } numTestsExecuted++;}
您在库中编写常规代码,然后您的测试应用程序包含库和测试模块。
可以为每种类型的值重载eq,write是比较数组等。
请参阅有关 TAP 的文档: http://testanything.org/wiki/index.php/Main_Page
是的,您可以争辩说 eq() 应该“只是”调用 ok()。或者您可以在输出中插入预期和实际结果。由你决定。
无论如何,对于命令式语言来说,有很多 TAP 解析器和解释器。
关于unit-testing - [在此处插入语言] 的测试框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/851144/
我是一名优秀的程序员,十分优秀!