Specflow - using data from external file in feature file(Specflow-在要素文件中使用外部文件中的数据)
问题描述
我正在使用specFlow进行测试,并正在寻找一种方法来在我的功能文件中使用来自EXCEL/CSV/json的inupt数据。我被要求使用specFlow+Excel,但它与我正在使用的.NETCore和specFlow 3.3.57不兼容。 我也尝试使用ITamaram.Excel.specFlowPlugin,但也不起作用。 https://github.com/Itamaram/SpecFlow.Plugin.Base 是否可以从外部文件读取输入数据并将其写入我的功能文件?
推荐答案
我们有一个新插件可以从JSON文件中获取外部数据。
这是一个简单的specFlow插件,可以作为NuGet package安装。
用法示例:
@property:email=E-mail_addresses.Valid
Scenario Outline: recording user information on successful registration
Given a visitor registering as "Mike Scott" with email <email>
When the registration completes
Then the account system should record <email> related to user "Mike Scott"
Examples: key examples
| Variant | email |
| simple valid email | simple@example.com |
json文件如下所示:
{
"E-mail addresses": {
"Valid" :{
"Simple": "email@domain.com",
"Dot in the address": "firstname.lastname@domain.com"
}
}
}
有关它的博客文章有更多详细信息:https://specflow.org/blog/new-plugin-externaldata-helps-you-improve-test-coverage-quickly/
全面披露:我是specFlow和specFlow+的社区经理
这篇关于Specflow-在要素文件中使用外部文件中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Specflow-在要素文件中使用外部文件中的数据
基础教程推荐
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
