c# - 如何从 specflow 的表中将整数添加到场景和功能文件中?为什么我会收到棕褐色错误
问题描述
当我将方案更改为使用表中的整数时,出现以下错误:参数计数不匹配!.,我所做的只是在工作正常的场景中将条件中的数字从 200 更改,但是当我使用时,请参阅代码,出现错误,这里:
Scenario: When I submit my request to an API
Given Given a valid input is used
When the specific request data is meets certain criteria
Then the status code for this test should be <ExpectedResult>
Examples:
| ExpectedResult|
| 200|
这一步非常标准,但错误在于上面的功能文件:
[Then(@"the status code for this test should be (.*)")]
public void ThenTheStatusForThisTestCodeShouldBe(int p0)
{
//Do I get the expected status codes
Assert.AreEqual(p0, 200);
}
我错过了什么吗?
解决方案
为了使用示例表,您必须将其指定为Scenario Outline
:
Scenario Outline: When I submit my request to an API
Given ...
When ...
Then ...
Examples:
| ExpectedResult |
| 200 |
推荐阅读
- python - 在 python 2 中使用 super() 引发类型错误
- python - 如何为 Keras 神经网络创建特异性自定义指标
- lwip - lwip 示例 netconn_new 总是返回 NULL
- javascript - chrome控制台中数组的不同表示
- ion-slide-box - 在 ion-slide-box 上显示寻呼机点
- oracle - 从 sql 提示符导出特定的 oracle 包(规范和正文)
- java - 试图弄清楚如何制作一个程序来识别相等的数字
- php - 带有 MSSQL 连接的 PHP 在命令行 (cmd) 中不起作用
- c# - 确定列表中对象层次结构中相对位置的有效方法
- ssl - 在 Dataflow 上运行的 Apache Beam 管道无法从 KafkaIO 读取:SSL 握手失败