我正在Postman中构建一套集成测试来测试一些RESTful API。我想在TeamCity中构建项目时运行这些测试。我正在考虑使用纽曼命令行集成,但我没有找到这方面的好例子。有谁能建议一种方法来实现这一目标?
答案 0 :(得分:1)
我能够使用newman和grunt来实现这一点。我在exec下添加了newman,并在我的gruntfile中添加了一个grunt任务。这需要指向newman npm包的本地实例(非全局)。
'use strict';
module.exports = function (grunt) { // eslint-disable-line
grunt.initConfig({
...
exec: {
newman: {
cmd: 'bin\\node.exe ./node_modules/newman/bin/newman run myProject.postman_collection.json'
}
},
...
});
grunt.registerTask('newman', ['exec:newman']);