postmoon
v2.1.1
Published
Run your postman tests without postman and without server.
Downloads
4
Maintainers
Readme
Warning: ALFA status, Not stable at all, everything can change.
postmoon
Startup
As glitch project
- Go to https://glitch.com/
- Click on "New project"
- Click on "Clone from git Repo"
- Enter
https://github.com/hacknlove/postmoon-glitch
As node project
- execute:
mkdir postoom-example
cd postmoon-example
npm init -y
npm i @hacknlove/postmoon
- Edit your
package.json
and set
"scripts": {
"start": "nodemon -e js,json --exec 'npm run postmoon'",
"postmoon": "postmoon"
},
- Execute
npm start
As bare folder
- execute:
mkdir postoom-example
cd postmoon-example
`npx nodemon -e js,json --exec 'npx postmoon'`
tests
Write your tests in files, you can all the postman's API.
If postmoon lacks of some postman's API characteristic you would like to use, please open an issue at issues
You cannot use the filenames global.js
, environment.js
and requests.js
environment variables
You can set your global
and environment
variables in the files global.json
and environment.json
Each each scenario starts with a fresh and clean copy of the variables.
{
"variableName": "variableValue",
"and": "so on"
}
requests
If you want to use pm.sendRequest()
you can set request globaly by the file requests.js
var requests = [
{
url: /regexp/,
code: 200
response: {
ok: true
}
},
{
url: /regexp/,
handler (request) {
return {
code: 200
response: {
ok: true
}
}
}
}
]
scenarios
Write the scenarios that are going to be used to each test your tests in a .json
file with the same name as the test .js
file
{
"global": {
},
"environment": {
},
pass: 3,
fail: 0,
requests: [
],
"scenarios": {
"scenarioName": {
"global": {
},
"environment": {
},
pass: 3,
fail: 0,
requests: [
],
response: {
}
}
}
}