如何将我的Postman集成测试与TeamCity集成

时间:2017-10-18 14:27:05

标签: teamcity postman

我正在Postman中构建一套集成测试来测试一些RESTful API。我想在TeamCity中构建项目时运行这些测试。我正在考虑使用纽曼命令行集成,但我没有找到这方面的好例子。有谁能建议一种方法来实现这一目标?

1 个答案:

答案 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']);

我将TeamCity设置为作为一个构建步骤部署到测试环境,并添加了一个调用我的任务的grunt构建步骤。 enter image description here

相关问题