[英]How to pass raw data json format from feature file to stepdefinition file in Cucumber
I have input data as json (complex data) format and want to write cucumber to test rest api. 我有输入数据为json(复杂数据)格式,并且想写黄瓜来测试其余的api。 How can I pass input json data from feature file to step definition file.
如何将输入的json数据从特征文件传递到步骤定义文件。 I know how can i pass multiple parameters , but don't know how to pass json data.
我知道如何传递多个参数,但不知道如何传递json数据。 The input json is very complex and don't know whether i can read it from file in classpath.
输入的json非常复杂,不知道我是否可以从classpath中的文件中读取它。
Don't write the json data in the feature file. 不要将json数据写入功能文件中。 Instead give it a name and refer to it by that name in your scenarios.
而是给它一个名称,并在您的方案中使用该名称进行引用。
Then use the name in your step definitions (or helper methods used by step definitions) to get the data. 然后在步骤定义中使用名称(或步骤定义使用的辅助方法)以获取数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.