如何找到没有使用的黄瓜步骤 [英] How to find Cucumber steps that are not used
问题描述
我一直在使用Cucumber大约一年,并一直不断地重构的功能和步骤的定义。我有许多步骤定义了许多文件,我不禁感到,因为他们中的许多不再需要。有没有办法找到哪些黄瓜步骤定义不再使用?
I've been working with Cucumber for about a year and have been continually refactoring the features and step definitions along the way. I have tons of steps defined across many files and I can't help but feel like many of them are no longer needed. Is there a way to find which cucumber step definitions are no longer being used?
推荐答案
stepdefs格式化可以做到这一点,
The stepdefs formatter can do this, e.g.:
cucumber --dry-run -f stepdefs
它会为任何不匹配项打印不匹配任何步骤。
It will print 'NOT MATCHED BY ANY STEPS' for any non-matches.
如果您有任何步骤仅用于其他步骤,然后忽略 - dry-run
以获得准确的结果。使用 - dry-run
,不执行步骤,黄瓜将不会发现引用步骤实际使用。
If you have any steps that are only used by other steps, then omit --dry-run
to get accurate results. With --dry-run
, the steps are not executed and cucumber will not find out that the referred step is actually used.
这篇关于如何找到没有使用的黄瓜步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!