我想到的唯一一个用于数据驱动测试的框架是 FIT 。我错过了什么吗?
是否有良好的商业选项?
PLS。请注意,我专注于测试设计人员对表格测试数据的低维护成本,最好是通过Excel完成。
谢谢,Bastl。
答案 0 :(得分:0)
特别是文章http://mrlalonde.blogspot.ca/2012/08/data-driven-tests-with-junit.html的链接回答了我的问题。
我的POV需要注意几点:
我非常喜欢它,所以我可以自由地粘贴相关的代码片段,以实现自包含:
public class DataDrivenTestExample extends TestCase {
private final String expected;
private final String actual;
// must be named suite() for the JUnit Runner to pick it up
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new DataDrivenTestExample("One", "answer", "answer"));
suite.addTest(new DataDrivenTestExample("Two", "result", "fail?"));
suite.addTest(new DataDrivenTestExample("Three", "run-all-tests!", "run-all-tests!"));
return suite;
}
protected DataDrivenTestExample(String name, String expected, String actual) {
super(name);
this.expected = expected;
this.actual = actual;
}
/**
* override this; default impl tries to reflectively find methods matching {@link TestCase#getName()}
*/
@Override
protected void runTest() throws Throwable {
assertEquals(expected, actual);
}
}