John Meyer
John Meyer

Reputation: 2356

How do I integrate my Postman Integration Tests with TeamCity

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?

Upvotes: 3

Views: 3148

Answers (1)

John Meyer
John Meyer

Reputation: 2356

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. enter image description here

Upvotes: 2

Related Questions