使用背景步骤,如大纲步骤 [英] Using a background step like an Outline Step

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

问题描述

我希望能够为文件中的每个场景定义一组运行规则.最容易放置这些的地方是在后台,但他们需要有一个类似于场景大纲的示例表.

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天全站免登陆