如何从功能文件准备json文件? [英] How to prepare json file from feature file?
本文介绍了如何从功能文件准备json文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以从BDD中的.feature文件准备json文件吗?
Is there any way to prepare json file from .feature file in BDD?
我正在尝试创建json文件,其中数据的输入源是.feature文件
I am trying to create json file where input source of data is .feature file
Feature: Testing a REST API
Scenario: Create student account using post method
Given api is up and running for post method
When i create json with below valuesand hit rest api
| Student_id |Name | CityName | State |PostCode |Tel |
| 0101 |Andrew | Leeds | | SO143FT | 345345345345 |
| 0102 |Smith | NewCastle | | SO143LN | 345345345345 |
Then Status is 201
下面是示例json文件.
Below is the sample json file.
{
"Student_id": 0101,
"Name": "test",
"CityName": "test",
"State": "TT",
"PostCode": 89098,
"Tel": "(000)- 000-0000",
}
推荐答案
为我的问题找到了解决方案:黄瓜中的表是数据表.
Found solution for my problem: table is datatable in cucumber.
List<String> jsons = table.asMaps(String.class, String.class)
.stream()
.map(gson::toJson)
.collect(Collectors.toList());
这篇关于如何从功能文件准备json文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文