如何根据场景大纲读取 csv 文件 [英] How to read csv file based on scenario outline

查看:21
本文介绍了如何根据场景大纲读取 csv 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 cucumber 并尝试根据场景名称从我的 csv 文件中读取行.

I am using cucumber and trying to read row from my csv file based on scenario name.

  Feature file :
    Scenario Outline: Verify content of my probblem1


Scenario,                       Title1, Title2, Title3, Title4, Title5
Verify content of my probblem1, Text1,  Text2,  Text3,  Text4,  Text5,
Verify content of my probblem2, Text1,  Text2,  Text3,  Text4,  Text5,

推荐答案

带有 qaf 的小黄瓜.您可以在 CSV/Excel/XML/json/DB 中有示例

The feature you are looking for is supported in gherkin with qaf. You can have examples in CSV/Excel/XML/json/DB

Scenario Outline: Search Keyword using data from file
When I search for "<searchKey>"
Then I get at least <number> results
Then it should have "<searchResult>" in search results

Examples:{'datafile':'resources/testdata.csv'}

您的 csv 文件可能如下所示:

where your csv file may look like below:

searchKey,searchResult,number,TestCaseId
QMetry QAF, QMetry Automation Framework,15,TC-001
Selenium ISFW,Infostretch Test Automation Framework,45,111

您可以参考文档分步教程

这篇关于如何根据场景大纲读取 csv 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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