以该文件为例:
Feature: Website visitor joins the test service
Scenario: The website visitor becomes a member
Given ....
When ....
Then ...
Scenario: The website visitor is too young to become a member
Given ....
When ....
Then ...
在查看Visual Studio测试资源管理器时,树形视图太长,如果不将测试资源管理器扩展得很宽,很难判断哪些场景已经通过:
MyProject.Specs
-JoinTestServiceSteps
--Website visitor joins the test service :: The website visitor becomes a member :: #1 (2)
---Website visitor joins the test service :: The website visitor becomes a member :: #1
---Website visitor joins the test service :: The website visitor is too young to become a member :: #2
可以将此更改为:
MyProject.Specs
-Feature Website visitor joins the test service (2)
--The website visitor becomes a member :: #1
--The website visitor is too young to become a member :: #2
答案 0 :(得分:2)
显示名称似乎来自项目的ScenarioXunitHook部分,该类将其中的功能名称和方案名称并入它们。
您可能希望提出功能请求,询问是否可以覆盖显示名称。
但是我认为TestExplorer中的显示(即它是嵌套的)更多地是Test Explorer本身的功能。
您可能希望通过Resharper运行测试,我已经有一段时间没有使用它了,但是如果我没记错的话将它与Specflow一起使用时,它对于BDD样式的测试名称往往更加用户友好-但这只是一些时间早于旧VS。
编辑:
Test Explorer可以自然地按“特征”分组
您可能希望探索将特质添加到Gherkin Quick中来利用它的想法。
看来Gerkin Quick将使用标签https://github.com/ttutisani/Xunit.Gherkin.Quick/blob/5927588a4f35b81ecea926975eb2815ebf96cbc3/docs/tags.md
并在测试中将它们设置为特征,因此这可能是一个不错的选择。