swagger-test-templates模块
swagger-test-templates模块
用法
npm install --save swagger-test-templatesvar stt = require('swagger-test-templates');
var swagger = require('/path/to/swagger.json');
var config = {
assertionFormat: 'should',
testModule: 'supertest',
pathName: ['/user', '/user/{id}'],
loadTest: [{pathName:'/user', operation:'get', load:{requests: 1000, concurrent: 100}}, { /* ... */ }],
maxLen: 80,
pathParams: {
"id": "0123"
}
};
// Generates an array of objects containing the test file content, following specified configuration
// the array contains objects with the scheme { name: <test-file-name>, test: <test-file-content> }
// tests = [ {name: base-path-test.js, test: ... }, {name: users-test.js, test: ... }]
var tests = stt.testGen(swagger, config);API
发送请求数据(requestData)
模拟HTTP请求体
模拟路径参数
模拟查询参数
模拟HTTP报头
Last updated