简体   繁体   English

如何使用SpecFlow C#实现多个条件

[英]How to implement multiple if else conditions using SpecFlow C#

I am new to Specflow.While writing Feature File,I give 3 Boolean Statements in Given Condition.And in Then Part, I need to check the Result based on given conditions. 我是Specflow的新手。在编写功能文件时,我在给定条件下给出了3个布尔语句。在然后的部分中,我需要根据给定条件检查结果。

It is a basic AND Gate Sample: 这是一个基本的AND门样本:

 Input:  YES   YES    YES
 Output: YES           
 Input:  YES   YES    NO 
 Output: NO

I think you want to use Scenario Outlines. 我认为您想使用方案大纲。

Here is an example for it: 这是一个例子:

Scenario Outline: AND Gate   
Given I have the following input on my AND GATE  
 | Input 1  | Input 2  | Input 3  |  
 | <input1> | <input2> | <input3> |

Then I have '<output>' at the output

Examples: | input1 | input2 | input3 | output |
          | Yes    | Yes    | Yes    | Yes    | 
          | Yes    | Yes    | No     | No     |

The stuff in the <> brakets are parameters. <>刹车中的东西是参数。
See the Gherkin reference for it here: https://cucumber.io/docs/reference#scenario-outline 请在此处查看Gherkin参考: https : //cucumber.io/docs/reference#scenario-outline

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM