API开发神器-Postman

Postman helps you develop APIs faster.

豪华午餐

Postman

Postman

构建、管理、文档化API

Newman(我真的不是MP3)

API自动化测试与持续集成

目的

  • 如何使用SuperTest测试框架,进行API测试
  • 如何将API测试与构建工具结合
  • 如何将API测试、构建工具与持续集成结合

SuperTestWithGulp

Gulp

Automate and enhance your workflow

用自动化构建工具增强你的工作流程!

1
2
3
➜  Downloads gulp -v
[15:59:38] CLI version 3.9.1
[15:59:38] Local version 3.9.1

Http-Header

Header

定义

提供HTTP所需要的信息或发送的信息

HTTP header fields provide required information about the request or response, or about the object sent in the message body.

SuperTest-header:Auth设置

SuperTest

Auth分类

Basic:基本身份认证,直接采用:用户名密码

  • 基本用法
    1
    2
    3
    4
    5
    6
    it('should receive a status code of 200 with login', function(done) {
    request(url)
    .get('/staging')
    .auth('the-username', 'the-password')
    .expect(200, done);
    });
  • Base64加密
1
.set("Authorization", "basic " + new Buffer("username:password").toString("base64"))
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×