使用背景步骤(例如“大纲"步骤) [英] Using a background step like an Outline Step

查看:83
本文介绍了使用背景步骤(例如“大纲"步骤)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够定义一组将针对文件中的每个方案运行的运行规则.最简单的放置位置是在后台,但是它们需要一个示例表,非常类似于场景大纲.

I would like to be able to define a set of run rules that will run for every scenario in the file. and the easiest place to put these would be in the background but they would need to have an examples table much like a scenario outline.

    Feature: Example Feature File
    In order to perform as task 
    As I user 
    I want this test to work 

Background: 
 Given I have used <data> in my test 
 Examples: 
 | data           | 
 | test string    | 
 | test String  2 | 


Scenario Outline: Running a test
Given I have prepared the test data 
When I run the test 
Then The test should pass 

任何人都可以想到我可以完成这项工作(或类似方法)的一种方法,因为我已经进行了200多次测试,而我有点不愿意将其添加到每个测试中

Can anyone think of a way i can make this work ( or something similar) as ive got over 200 tests and im a little loathed to add this to each one of them

推荐答案

不幸的是,您需要在每种情况下都使用它.您无法提供背景数据示例.

Unfortunately you need to put this in each scenario. You cannot provide example data for the background.

这篇关于使用背景步骤(例如“大纲"步骤)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆