如何查找未使用的 Cucumber 步骤步骤、Cucumber

由网友(知道我在想你)分享简介:我已经使用 Cucumber 大约一年了,并且一直在不断地重构功能和步骤定义.我在许多文件中定义了大量步骤,我不禁觉得其中许多不再需要.有没有办法找出哪些黄瓜步骤定义不再被使用?I've been working with Cucumber for about a year and have been continu...

我已经使用 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

它将打印任何不匹配的NOT MATCHED BY ANY STEPS".

It will print 'NOT MATCHED BY ANY STEPS' for any non-matches.

如果您有任何步骤仅被其他步骤使用,则省略 --dry-run 以获得准确的结果.使用--dry-run,不会执行steps,cucumber不会发现实际使用了引用的step.

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.

阅读全文

相关推荐

最新文章