Behave测试框架的测试覆盖工具
问题描述
我们正在使用 Behave BDD 工具来自动化 API.是否有任何工具可以使用我们的行为案例提供代码覆盖率?
We are using Behave BDD tool for automating API's. Is there any tool which give code coverage using our behave cases?
我们尝试使用覆盖模块,但它不适用于 Behave.
We tried using coverage module, it didn't work with Behave.
解决方案
您可以运行任何具有覆盖率的模块以查看代码使用情况.在你的情况下应该接近 coverage run --source='.'-m 行为
You can run any module with coverage to see the code usage.
In your case should be close to coverage run --source='.' -m behave
跟踪 Aceptace/Integration/Behaviour 测试的代码覆盖率很容易给出较高的覆盖率,但可能会让人认为代码经过了适当的测试.
Tracking code coverage for Aceptace/Integration/Behaviour test will give a high coverage number easily but can lead to the idea that the code are properly tested.
这些是为了查看协同工作,而不是跟踪有多少代码被很好地覆盖".
Those are for see things working together, not to track how much code are well 'covered'.
将单元测试和覆盖率捆绑在一起对我来说更有意义.
Tying together unittests and coverages makes more sense to me.
相关文章