cucumber - 如何在空手道的同一请求中传递表单数据文本和文件?
问题描述
我正在尝试对上传文件(图像、pdf)的 POST 请求进行测试。我的功能文件如下:
给定路径 'files' * multipart file fileUpl = { read: 'img1.jpeg', filename: 'img1.jpeg' } * multipart field destination = "posts" When method post Then status 200
文件被正确拾取,但没有拾取目标字段值。
回复:
混合:内容配置:表单数据;名称="文件上传"; 文件名="img1.jpeg" 内容类型:图像/jpeg;charset=UTF-8 内容长度:757770 已完成:true IsInMemory:false RealFile:/Users/deepanshu/Desktop/NoonCode/nimble/automation/target/test-classes/apiTests/files/img1.jpeg DefaultDeleteAfter:true
内容处置:表单数据;名称="目的地"; 文件名=“”内容类型:文本/纯文本;charset=UTF-8 内容长度:5 已完成:true IsInMemory:true
在上述情况下,我们如何传递具有值的字段。
解决方案
推荐阅读
- java - 整数数组的除法和求和
- java - 如何手动验证 EditText?
- angular - 使用可观察对象限制 API 请求
- .net-core - InvalidCastException 使用 Newtonsoft.Json 反序列化 SqlException
- opencart - 成功下单后,“减去库存”发生在哪个 .php 文件中?
- java - @DataJpaTest 在刷新 spring.jpa.hibernate.ddl-auto=create-drop 时找不到表
- javascript - 在 TextField 中切换到 RTL:JssProvider 不存在于“react-jss/lib/JssProvider”中,而仅存在于“react-jss/src/JssProvider”中
- javascript - 变量调用在订阅者函数之外返回值“未定义”
- oracle - 创建编辑视图时出现错误 ORA-00933
- python-3.x - 为什么我收到 DataFrame 点函数的矩阵未对齐错误?