• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

michaelruocco/gradle-postman-runner: A gradle plugin to run Postman collections

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

michaelruocco/gradle-postman-runner

开源软件地址(OpenSource Url):

https://github.com/michaelruocco/gradle-postman-runner

开源编程语言(OpenSource Language):

Java 73.6%

开源软件介绍(OpenSource Introduction):

gradle-postman-runner

A gradle plugin to run Postman collections.

The runner makes use of newman run by gradle-node-plugin.

By default, all postman collection files (ending with .postman_collection.json) in src/test are run.

Usage

plugins {
    id "com.github.michaelruocco.gradle-postman-runner"
}

If not already done, you may want to configure the gradle-node-plugin. At least download has to be enabled as of version 0.13. See gradle-node-plugin documentation for more options.

node {
   download = true
}

That's all needed to execute the postman task: ./gradlew postman

An optional configuration of postman itself is done with the postman extension:

// postmanrunner configuration
postman {
    // specifies collection file pattern
    // default: src/test/**/*.postman_collection.json
    collections = fileTree(dir: 'src/test', include: '**/*.myCollection*')
    
    // specifies the test environment to execute the collections with
    // default: no environment
    environment = file('src/test/some_environment.postman_environment.json')
    
    // specifies any environment variables to execute the collections with
    // will override any values from the environment file above
    // default: no environment variables
    envVars = [ "myVar" : "myVarValue" ]
    
    // specifies the a global variable file to execute the collections with
    // default: no globals
    globals = file('./postman_globals.json')

    // specifies any global variables to execute the collections with
    // will override any values from the globals file above
    // default: no global variables
    globalsVars = [ "myVar" : "myVarValue" ]
    
    // stops entire execution on first failing test in a collection
    // default: false
    stopOnError = true

    // reports to stdout
    // default: true
    cliReport = false
    
    // when windows gives you lemons on cli output...
    // default: false
    disableUnicode = false
    
    // enables/disables ssl verification checks and allows self-signed certificates
    // default: true
    secure = false

    // creates junit compatible XML result files in directory
    // default: off
    xmlReportDir = 'build/testoutput'
    
    // adds html output with default template to given path
    // default: off
    htmlReportDir = 'build/tesdtoutput/html'
    
    // define a handlebars template for html output
    // default: newman's default template https://github.com/postmanlabs/newman/blob/develop/lib/reporters/html/template-default.hbs
    htmlTemplate = 'custom-template.hbs'
    
    // adds plain json output with default template to given path
    // default: off
    jsonReportDir = 'build/tesdtoutput/json'
}

Besides a global configuration with the 'postman' extension as seen above, it's also possible to create a custom task and override all of the global configuration values (if any given):

task postmanOnDifferentEnvifonment(type: uk.co.mruoc.postman.task.PostmanTask) {
    environment = file('different_environment.postman_environment.json')
    stopOnError = false
}

Useful Commands

// cleans build directories
// prints currentVersion
// formats code
// builds code
// runs tests
// checks for gradle issues
// checks dependency versions
./gradlew clean currentVersion dependencyUpdates lintGradle spotlessApply build



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap