Skip to main content

Capture Traffic from Postman

tip

You can run your Postman tests automatically with Newman.

Running tests through Optic with Postman#

Optic helps you run your existing Postman tests against your project, adding in schema checks for every request and response seen. The tests you have today can help establish the baseline behavior of your API and assert that your API is behaving according to the specification Optic has recorded. Tests are run with a single command:

api run test

Pre-requisites#

Before running tests, you'll need to integrate with your current project. We recommend following the instructions to set up your framework's api start command, and to use a middleware integration where available:

Integrating your Postman tests manually#

If your project is integrated with Optic using middleware, configuring a test task is as easy as configuring a start task. If using a middleware integration is not feasible, Optic can use your working start task to make running your tests through your proxy integration easy.

Configuring Optic to run your tests#

The middleware integration will assure Optic sees your traffic, no matter if it is sent interactively or through a test collection like with Postman. Since Postman tests are run manually, you will use your current start task to start your application and activate the middleware. No configuration changes are needed either in Optic or in Newman.

note

As this is a manual integration, you'll use api start to start up your API and run your Postman tests by hand. When testing, substitute the api start or api run start commands for api test or api run test. Postman testing with Optic can be automated using Newman.