我试图在我的测试1.js中使用它:
const newman = require('newman'); // require newman in your project
// call newman.run to pass `options` object and wait for callback
newman.run({
collection: require('./postman/poc_collection.json')
environment: require('./postman/poc_env.json'),
exportGlobals: require('./postman/poc_globals.json'),
reporters: 'cli'
}, function (err) {
if (err) { throw err; }
console.log('collection run complete!');
});当运行完成时,将生成文件newman-globals-2019-01-11-14-39-00-154-0.json,而不是使用上面指定的poc_globals.json文件。
newman命令行中的--选项工作正常。
我错过了什么?
谢谢你,拉姆亚
发布于 2019-11-06 10:18:36
在设置globals文件的路径时,不应该使用require()。尝试:
exportGlobals: './postman/poc_globals.json',但是,如果希望脚本从globals文件中加载变量,则需要使用它。
globals: require('./postman/poc_globals.json'),https://stackoverflow.com/questions/54149045
复制相似问题