Cucumber:@SmokeTest标记场景大纲中的一个场景



我是Cucumber中标记的新手。我已经建立了一个自动化套件,并确定了所有可以使用@SmokeTest标签有效标记为烟雾测试的测试。

但是,有办法做到以下几点吗?我不想将整个场景大纲标记为SmokeTest,只想将一个测试/响应标记为场景,如下所示:

我不想要什么-因为这将测试所有场景

@SmokeTest    
Scenario Outline: Number is or is not valid
Given I send an event with the "Number" set to <num>
Then I will receive the following <message>
Examples:
| num    | message           |                                                                                     
| 0      | "Processed event" |                                                        
| 1      | "Processed event" |                                                                  
| 2      | "Processed event" |                                                                 
| 3      | "Processed event" |                                                                 
| 4      | "Processed event" |                                                                 
| 5      | "Processed event" |                                                                                                                                 
| 6      | "Message failed"  |
| -1     | "Message failed"  |
| "One"  | "Message failed"  |

我想要什么-使用标记为烟雾测试的数字1

Scenario Outline: Number is or is not valid
Given I send an event with the "Number" set to <num>
Then I will receive the following <message>
Examples:
| num    | message           |                                                                                     
| 0      | "Processed event" |                                                        
@SmokeTest | 1      | "Processed event" |                                                                  
| 2      | "Processed event" |                                                                 
| 3      | "Processed event" |                                                                 
| 4      | "Processed event" |                                                                 
| 5      | "Processed event" |                                                                                                                                 
| 6      | "Message failed"  |
| -1     | "Message failed"  |
| "One"  | "Message failed"  |

这可能吗?还是用我想要的烟雾测试创建一个单独的场景定义更好?

非常感谢!

Kirsty

您可以标记examples部分并拥有多个examples部分。

@SmokeTest    
Scenario Outline: Number is or is not valid
Given I send an event with the "Number" set to <num>
Then I will receive the following <message>

@SmokeTest
Examples: 
| num    | message           |                                                                                     
| 0      | "Processed event" |   
Examples: You can also name these 
| num    | message           |                                                                                                                                          
| 1      | "Processed event" |                                                                  
| 2      | "Processed event" | 

相关内容

  • 没有找到相关文章

最新更新