Giter Site home page Giter Site logo

Postman to stREST about strest HOT 4 OPEN

eykrehbein avatar eykrehbein commented on July 29, 2024
Postman to stREST

from strest.

Comments (4)

jgroom33 avatar jgroom33 commented on July 29, 2024

@eykrehbein
help on this would be appreciated: https://github.com/eykrehbein/strest/blob/feature/postman_import/src/postman.ts#L80

to test:
node dist/main.js tests/postman/Postman\ Import.postman_collection.json -m

  • handle {{foo}} as hostname
  • convert pm.response.to.have.status(200) to validates @eykrehbein
  • convert pm.response.to.have.jsonBody('args.foo1', 'bar1') to validate @eykrehbein
  • convert pm.response.to.have.body(raw body) to validate @eykrehbein
  • handle headers
  • use url.(protocol, host, path) instead of url.raw
  • convert query params (instead of using url.raw)
  • create directories and files

from strest.

eykrehbein avatar eykrehbein commented on July 29, 2024

I'm on it 👍 @jgroom33

from strest.

eykrehbein avatar eykrehbein commented on July 29, 2024

@jgroom33 is the param of .to.have.jsonBody an object?

from strest.

jgroom33 avatar jgroom33 commented on July 29, 2024

Looks like the .to.have.jsonBody can test whether the param exists and whether it is equal to a value.
I'm assuming we could only currently support:

validate:
  jsonpath:
    args.foo2: bar2

curl https://postman-echo.com/get?foo1=bar1&foo2=bar2
returns:

{
    "args": {
        "foo1": "bar1",
        "foo2": "bar2"
    },
    "headers": {
        "x-forwarded-proto": "https",
        "host": "postman-echo.com",
        "accept": "*/*",
        "accept-encoding": "gzip, deflate",
        "cookie": "sails.sid=s%3ApXoOiKY5-aoRZBuqlwdN0MJ2krjLjx21.c8qegiylITH2DQ9vyj%2BFMe74GEDtC%2BVmi1Y1TxO4fDQ",
        "user-agent": "PostmanRuntime/7.3.0",
        "x-forwarded-port": "443"
    },
    "url": "https://postman-echo.com/get?foo1=bar1&foo2=bar2"
}

tests:

pm.test("response body has json with request queries", function () {
    pm.response.to.have.jsonBody('args')
        .and.have.jsonBody('args.foo2', 'bar2')
    pm.response.to.have.jsonBody('args.foo1', 'bar1');
    pm.response.to.have.jsonBody('headers')
});

from strest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.