Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback for “Migrating from Postman” #90

Open
kaemelle opened this issue Aug 6, 2024 · 0 comments
Open

Feedback for “Migrating from Postman” #90

kaemelle opened this issue Aug 6, 2024 · 0 comments

Comments

@kaemelle
Copy link

kaemelle commented Aug 6, 2024

Hello,
I try to migrate my API tests scripts from postman
I have a lot with a test which valid the Json shema of the response.
In Postman I wrote this like that

var schema = 
{json model schema}
;

const response = pm.response.json();
    pm.test('Schema is valid', () => {
        pm.expect(response).to.have.jsonSchema(schema);
    });

and it doesn't work with Bruno

I have seen a solution in https://medium.com/@jagdalebr/brunos-api-adventure-7937abb70d47

const Ajv = require('ajv');
const ajv = new Ajv();
const schema = 
{json model schema}
test("should be able to validate JSON", function() {
  const data = res.getBody();
  const valid = ajv.validate(schema, data);
  expect(res.getStatus()).to.equal(200);
  expect(valid).to.be.true;
  if (!valid) console.log(ajv.errors);
});


Is it possible to intégrate this to the Import from postman tool and the Bruno's translator ?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant