groovy - Katalon/Groovy - 使用 newman 运行邮递员请求
问题描述
我正在尝试在我的 katalon 脚本中使用 newman 运行邮递员请求。
import java.util.*
import java.io.*
String path = RunConfiguration.getProjectDir() + '/Data Files'
String proj = '"PostmanCollection.json"'
String file= 'Book1.csv'
String Resquest1= '"Resquest1 Postman"'
String Resquest2= '"Resquest2 Postman"'
String Resquest3= '"Resquest3 Postman"'
println(path)
String cmd = 'cmd cd ' + path
println(cmd)
String createObj = 'cmd /c "newman run ' + proj + ' --folder ' + Resquest1 + ' --folder ' + Resquest2 + ' --folder ' + Resquest3 + ' -d ' + file + ' -n 1 > log.txt"'
println(createObj)
Runtime.getRuntime().exec(createObj, null, new File(path)).waitFor()
它为我生成了一个空文件,但是如果我直接在命令提示符下使用 groovy 在“createObj”中生成的 newman 命令,我可以让它工作并且生成文件就好了。
如果我改用它,该文件也创建得很好。但我需要同时运行另外两个请求。
String createObj = 'cmd /c "newman run ' + proj + ' --folder ' + Resquest1 + ' -d ' + file + ' -n 1 > log.txt"'
你看到那里有问题吗?
解决方案
推荐阅读
- javascript - 如何在 div 中加载网页
- android - 尝试使用 Retrofit 发出获取请求时无法为类 java.lang.Object 创建调用适配器
- python - 是其他两个列表之间的列表
- javascript - 如何定位 JSON 对象中的特定键,然后按该键数组中的 id 匹配?
- reactjs - 自定义挂钩上的无效挂钩调用
- javascript - react js中点击按钮后如何模糊背景
- reactjs - 在打字稿 nextjs 中使用 ref
- javascript - 获取多个异步 url 数据,然后对结果进行操作(tampermonkey 脚本)
- swagger - 如何在 Swagger-jsdoc 中安排端点和类别?
- flask - 为什么即使我将任意名称传递给 Flask 类的“import_name”属性,我的服务器仍会运行?