Specflow:如何通过 ValueRetriever 生成唯一字符串并将其存储到当前场景中,而不会在并行执行中出现任何问题
使测试数据具有唯一性,以便在测试中正确选择。我正在寻找解决方案来生成唯一的字符串并将其替换为功能文件中的“(*)”。生成的唯一字符串应该保留到场景的末尾,并且在并行执行测试时是安全的(每个场景应该保存自己的唯一字符串)。
我目前通过创建自定义类 UniqueStringRetriever : IValueRetriever
来生成唯一字符串,但不知道如何注册它以避免并行执行问题。
有谁对这种情况有想法,请在这里留下您的帮助。我确实很欣赏这一点。
Background:
Given the following Customer
| First Name | Last Name |
| David (*) | Brown |
Scenario: Search Customer by First Name
When user search Customer by First Name
| First Name |
| David (*) |
Then the result list displays 'David (*)' customer
to make test data unique for correctly selecting in tests. I'm looking for solution to generate a unique string and replace it to the "(*)" in Feature file. The generated unique string should be remained to the end of the Scenario, and it's safe when tests are executed parallelly (each Scenario should hold its own unique string).
I currently generate the unique string by create a custom class UniqueStringRetriever : IValueRetriever
but duno how to register it to avoid parallel execution problem.
Does anyone have idea for this situation please leave your help in here. I do appreciate that.
Background:
Given the following Customer
| First Name | Last Name |
| David (*) | Brown |
Scenario: Search Customer by First Name
When user search Customer by First Name
| First Name |
| David (*) |
Then the result list displays 'David (*)' customer
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论