How do I integrate my Postman Integration Tests with TeamCity

偶尔善良 提交于 2020-01-01 18:08:08

问题


I'm building a suite of integration tests in Postman to test some RESTful APIs. I'd like to run these tests when building the project in TeamCity. I'm looking at perhaps using Newman command line integration, but I not finding good examples of this. Can anyone suggest an approach to make this happen?


回答1:


I was able to get this working using newman and grunt. I added newman under exec, and also added a grunt task in my gruntfile. This needed to point to the local instance of the newman npm package (not global).

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

I set TeamCity to deploy to a test environment as one build step and added a grunt build step that called my task.



来源:https://stackoverflow.com/questions/46812572/how-do-i-integrate-my-postman-integration-tests-with-teamcity

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!