使用Flutter test和drive选项时,我们是否可以根据先前测试的结果来控制某些测试的执行?我们在测试中有一个skip选项。然而,我无论如何也找不到检查程序中之前的测试是否通过的方法。例如:
void main() {
group('Group A', () {
FlutterDriver driver;
// Connect to the Flutter driver before running any tests.
setUpAll(() async {
driver = await FlutterDriver.connect();
});
// Close the connection to the driver after the tests have completed.
tearDownAll(() async {
if (driver != null) {
driver.close();
}
});
test('Test A', () async {
});
test('Test B', () async {
});
test('Test C', () async {
});
});
}我的问题是,如果A失败,我如何跳过B和C的执行,以及我如何跳过组B id组A测试失败的执行?
发布于 2020-01-10 02:57:39
似乎没有一种明确的方法来声明测试依赖关系,但您可以跟踪哪些测试已经通过,并使用该信息有条件地跳过后续测试,例如
final passed = <String>{};
test("a", () {
expect(1 + 1, 3);
passed.add("a");
});
test("b", () {
expect(2 + 2, 5);
}, skip: !passed.containsAll(["a"]));https://stackoverflow.com/questions/58385557
复制相似问题