黄瓜:如何从外部Excel文件中读取场景概述示例 [英] Cucumber : How to read examples from external excel file for Scenarios Outline

查看:70
本文介绍了黄瓜:如何从外部Excel文件中读取场景概述示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的要求是从外部excel文件中读取示例,而不是将其硬编码到功能文件中.我有100多个示例,这些示例很难在功能文件中维护.你能帮我这个忙吗?

My requirement is to read examples from external excel file rather than hard code it into feature file. I have more than 100 examples which is difficult to maintain in feature file. Can you please help me on this.

这是我的情况-

Scenario Outline: Browser Test

    When I visit the URL <base>/<page>/<ordNumber>/<custName>
    Then the browser contains test <custNumber>

    Examples: 
     | base                         | page   | ordNumber | custName |
     | http://www.stackoverflow.com | orders | 123       | John     |
     | http://www.stackoverflow.com | orders | 456       | Mike     |
     | http://www.stackoverflow.com | orders | 789       | Tom      |

我想用示例数据创建一个excel文件并在运行时加载

I want to create an excel file with examples data and load it during runtime

examples.xls

 | base                         | page   | ordNumber | custName |
 | http://www.stackoverflow.com | orders | 123       | John     |
 | http://www.stackoverflow.com | orders | 456       | Mike     |
 | http://www.stackoverflow.com | orders | 789       | Tom      |

谢谢.

推荐答案

使用与QAF配合使用的小黄瓜.QAF支持不同的外部数据提供程序,包括json,xml,csv,excel和DB.它还支持多种bdd语法.

What you are looking for is supported using gherkin with QAF. QAF support different external data providers including json, xml, csv, excel and DB. It also supports multiple bdd syntax.

下面结合使用带有QAF的Gherkin或BDD2:

Using Gherkin or BDD2 with QAF below is the example:

Scenario Outline: Browser Test

    When I visit the URL <base>/<page>/<ordNumber>/<custName>
    Then the browser contains test <custNumber>

    Examples: {'datafile': 'resources/testdata/examples.xls'}

资源管理,执行配置,驱动程序管理和并行执行还有很多其他功能.

There are lots of other features as well for resource management, execution configuration, driver management and parallel execution.

这篇关于黄瓜:如何从外部Excel文件中读取场景概述示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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