因此,如果我总共有4个测试,如果第一个测试失败,我希望在第一个测试中快速失败,然后我希望继续运行其他3个测试/功能文件。
它现在所做的,我不喜欢的是,一旦一个测试失败,它就会失败,并且不会运行任何其他功能文件。
有什么想法吗?
我在黄瓜选项中尝试过:
'fail-fast': true,但如果出现故障,将停止执行。
发布于 2020-04-16 12:01:39
如果您想要跳过功能文件中的其余测试,一旦该文件中的测试失败,则需要执行以下操作:
在每个要素文件的顶部,添加一个类似于@feature_<something unique>.
Before After// a place to track all of the failed scenarios.
const failedFeatures = [];
// identifies the feature tag using the pickle object.
function getFeature(pickle) {
return pickle.tags.map(i => i.name).filter(i => i.indexOf('@feature_') === 0)[0];
}
// determines if the feature has failed, if it has then skip this test.
Before(function ({ pickle }) {
const feature = getFeature(pickle);
if (failedFeatures.indexOf(feature) >= 0) {
return 'skipped';
}
});
// if a test has failed, record that this feature has also failed.
After(function ({ pickle, result }) {
const feature = getFeature(pickle);
if (result.status === 'failed') {
failedFeatures.push(feature);
}
});https://stackoverflow.com/questions/57582998
复制相似问题