如何在Katalon api请求中将表格数据与文件嵌套

时间:2019-05-09 17:20:03

标签: rest katalon-studio

我正在尝试建立视觉回归测试,并决定使用Spectre进行屏幕截图比较。无法弄清楚如何使用Katalons API调用发布屏幕截图 我要发送的请求:

POST /tests
test:
run_id: {run_id from above},
name: Homepage,
platform: OSX,
browser: PhantomJS,
size: 1024,
screenshot: <File>,
crop_area: '640x480+50+100'

我显然不能正确嵌套此参数,但是无论如何都无法在“测试”下嵌套参数

我的代码

RequestObject ro2 = new RestRequestObjectBuilder()
                .withRestUrl(endpoint)
                .withHttpHeaders(defaultHeaders)
                .withRestRequestMethod("POST")
                .withMultipartFormDataBodyContent([
                    new FormDataBodyParameter('run_id', '7', 'PARAM_TYPE_TEXT'),
                    new FormDataBodyParameter('name', 'Homepage',  'PARAM_TYPE_TEXT'),
                    new FormDataBodyParameter( 'platform', 'Windows', 'PARAM_TYPE_TEXT'),
                    new FormDataBodyParameter( 'browser', 'Chrome', 'PARAM_TYPE_TEXT'),
                    new FormDataBodyParameter( 'size', '1024', 'PARAM_TYPE_TEXT'),
                    new FormDataBodyParameter( 'screenshot', "C:\\Users\\aalago\\Desktop\\paths\\devscreens\\fb vt-new-and-popular-SplitView_TabPaneB4B2Article_ArticleNewPopularCombined.png", 'PARAM_TYPE_FILE')
                ])
                .build()

        ResponseObject respObj2 = WS.sendRequest(ro2)

0 个答案:

没有答案