如何将我的 Postman 集成测试与 TeamCity 集成 [英] How do I integrate my Postman Integration Tests with TeamCity

查看:18
本文介绍了如何将我的 Postman 集成测试与 TeamCity 集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Postman 中构建一套集成测试来测试一些 RESTful API.我想在 TeamCity 中构建项目时运行这些测试.我正在考虑使用 Newman 命令行集成,但我没有找到很好的例子.任何人都可以提出一种方法来实现这一点吗?

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?

推荐答案

我能够使用 newman 和 grunt 来完成这项工作.我在 exec 下添加了 newman,还在我的 gruntfile 中添加了一个 grunt 任务.这需要指向 newman npm 包的本地实例(不是全局的).

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

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

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

这篇关于如何将我的 Postman 集成测试与 TeamCity 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆