rest-api-testing-codegen
v0.2.1
Published
Since I operated the browser, only the API is recorded and the code is generated.
Downloads
34
Readme
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
- generate test code
npx rest-api-testing-codegen --baseURL=https://google.co.jp --headers=cookie
- install
@playwright/test
for test code
npm i -D @playwright/test
- 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;