mardi 26 mars 2019

How to reference a file from a pre-request script or a test script in Postman?

Problem Description: I have a file containing json schema. I want to use the schema to validate multiple collections in Postman. I want to be able to reference this file from a pre-request script or test-script.

What I've tried so far:

  • Globals/Data file: I have tried defining the schema as a globals file and importing that file at run-time. Using Newman command line, that involves modifying the run query. The test-automation criteria does not allow me to modify the run queries.
  • Separate collection: The schema could be separated into it's own collection and mentioned in a pre-request script to set global variable. The global variable can be used across all collections. The problem with this approach is a dummy request is needed to run the pre-request script.
  • File: Hence, I thought of putting schema in a file and see if there's a way to reference that from pre-request script.

Thanks!

Aucun commentaire:

Enregistrer un commentaire