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

查看:184
本文介绍了如何将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设置为作为一个构建步骤部署到测试环境,并添加了一个笨拙的构建步骤,该步骤称为我的任务。

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天全站免登陆