rest-api-testing-codegen

0.2.1 • Public • Published

Rest Api Testing Codege

Since I operated the browser, only the API is recorded and the code is generated.

Installation

npm install -D rest-api-testing-codegen

Usage

  1. generate test code
npx rest-api-testing-codegen --baseURL=https://google.co.jp --headers=cookie
  1. install @playwright/test for test code
npm i -D @playwright/test
  1. run test code
npx playwright test sample.spec.ts

Options

full name shot name command line config file desc defaults
baseURL u Y Y Opens a browser at the specified URL
indent i Y Y Indent the output code 2 spaces
output o Y Y File name of the output code sample.spec.ts
format f Y Y Format of output code playwright
headers h Y Y Prints the code only if the specified header is present.
ignoreheaders Y Y Specifies headers to exclude from validation referer,content-type,content-length
skipheaders Y Y Skips the header output. false
expect N Y Specify the verification format of the response data.
config c Y N Specify the configuration file. rest-api-testing-codegen.config.js
resourceType Y Y Specifies the resource type to validate. ex) all, document, stylesheet, image, media, font, script, texttrack, xhr, fetch, eventsource, websocket, manifest, other xhr
skipexpectjson Y Y Skips generate expect of json. false

Setting Config

  • rest-api-testing-codegen.config.js
const config = {
    baseURL:"https://google.co.jp/",
    output:"hoge.spec.ts",
    headers:["cookie"]
};
module.exports = config;

Readme

Keywords

Package Sidebar

Install

npm i rest-api-testing-codegen

Weekly Downloads

10

Version

0.2.1

License

MIT

Unpacked Size

19.1 kB

Total Files

12

Last publish

Collaborators

  • sakamoto66