CircleCI postman API automate testing not working

Why cirlceci converting version 2.1 to version 2.0?

Hello @dhavalsoni2001,

A 2.1 config will be “processed” into a 2.0 config. 2.1 allows you to use features like Orbs, which are fetched and then “expanded” into your final version 2 config.

What error are you running into?

I have set up postman with circle ci by following this article: https://circleci.com/blog/set-up-a-circleci-pipeline-to-run-a-postman-collection-using-the-newman-orb/

So when config 2.1 processed into a 2.0 at that time code for postman has been comment out and not executing.

# Orb 'postman/newman@0.0.2' resolved to 'postman/newman@0.0.2'
version: 2
jobs:
  build:
    docker:
    - image: circleci/node:6.11.4
    steps:
    - checkout
    - run:
        command: sudo npm install -g cordova@6.5.0
        name: add-cordova
    - run:
        command: sudo npm install -g ionic@1
        name: add-ionic
    - run:
        command: sudo npm install gulp-cli -g
        name: add-gulp-cli
    - run:
        command: sudo npm install -g gulp -D
        name: add-gulp
    - run:
        command: sudo npm -g install bower
        name: add-bower
    - run:
        command: npm install
        name: add-node-modules
    - run:
        command: bower install
        name: add-bower
    - run:
        command: gulp staging
        name: build-staging
    - run:
        command: ionic state reset
        name: ionic-state-reset
    - run:
        command: npm test
        name: test
workflows:
  version: 2
  workflow:
    jobs:
    - build

# Original config.yml file:
# version: 2.1
# orbs: 
#   newman: postman/newman@0.0.2
# jobs: 
#   build: 
#     docker: 
#       - 
#         image: \"circleci/node:6.11.4\"
#     steps: 
#       - checkout
#       - run: 
#           command: \"sudo npm install -g cordova@6.5.0\"
#           name: add-cordova
#       - run: 
#           command: \"sudo npm install -g ionic@1\"
#           name: add-ionic
#       - run: 
#           command: \"sudo npm install gulp-cli -g\"
#           name: add-gulp-cli
#       - run: 
#           command: \"sudo npm install -g gulp -D\"
#           name: add-gulp
#       - run: 
#           command: \"sudo npm -g install bower\"
#           name: add-bower
#       - run: 
#           command: \"npm install\"
#           name: add-node-modules
#       - run: 
#           command: \"bower install\"
#           name: add-bower
#       - run: 
#           command: \"gulp staging\"
#           name: build-staging
#       - run: 
#           command: \"ionic state reset\"
#           name: ionic-state-reset
#       - run: 
#           command: \"npm test\"
#           name: test

Hello @dhavalsoni2001,

I see you are importing the orb but it does not appear you are using it in your config.

The commented out line you mention is only there to tell you what version of the orb was fetched. This states you did fetch postman/newman@0.0.2 correctly.

In order to use the orb, try invoking one of its commands or jobs.

https://circleci.com/orbs/registry/orb/postman/newman#commands-newman-run

Take a look at the usage exampels at hte top of the registry page for the orb.

version: 2.1
orbs:
  newman: postman/newman@1.0.0
jobs:
  newman-collection-run:
    executor: newman/postman-newman-docker
    steps:
      - checkout
      - newman/newman-run:
          collection: ./collection.json

This snippet imports the orb:

orbs:
  newman: postman/newman@1.0.0

But on it’s own this will do nothing.

This is the piece that makes use of the imported orb:

 - newman/newman-run:
          collection: ./collection.json

Thanks for response @KyleTryon. I have also tried with adding that in jobs but facing the same issue.

# Orb 'postman/newman@0.0.2' resolved to 'postman/newman@0.0.2'
version: 2
jobs:
  build:
    docker:
    - image: circleci/node:6.11.4
    steps:
    - checkout
    - run:
        command: sudo npm install -g cordova@6.5.0
        name: add-cordova
    - run:
        command: sudo npm install -g ionic@1
        name: add-ionic
    - run:
        command: sudo npm install gulp-cli -g
        name: add-gulp-cli
    - run:
        command: sudo npm install -g gulp -D
        name: add-gulp
    - run:
        command: sudo npm -g install bower
        name: add-bower
    - run:
        command: npm install
        name: add-node-modules
    - run:
        command: bower install
        name: add-bower
    - run:
        command: gulp staging
        name: build-staging
    - run:
        command: ionic state reset
        name: ionic-state-reset
    - run:
        command: npm test
        name: test
workflows:
  version: 2
  workflow:
    jobs:
    - build

# Original config.yml file:
# version: 2.1
# orbs: 
#   newman: postman/newman@0.0.2
# jobs: 
#   newman-collection-run: 
#     executor: newman/postman-newman-docker
#     steps: 
#       - checkout
#       - 
#         newman/newman-run: 
#           collection: ./postman_collection.json
#   build: 
#     docker: 
#       - 
#         image: \"circleci/node:6.11.4\"
#     steps: 
#       - checkout
#       - 
#         run: 
#           command: \"sudo npm install -g cordova@6.5.0\"
#           name: add-cordova
#       - 
#         run: 
#           command: \"sudo npm install -g ionic@1\"
#           name: add-ionic
#       - 
#         run: 
#           command: \"sudo npm install gulp-cli -g\"
#           name: add-gulp-cli
#       - 
#         run: 
#           command: \"sudo npm install -g gulp -D\"
#           name: add-gulp
#       - 
#         run: 
#           command: \"sudo npm -g install bower\"
#           name: add-bower
#       - 
#         run: 
#           command: \"npm install\"
#           name: add-node-modules
#       - 
#         run: 
#           command: \"bower install\"
#           name: add-bower
#       - 
#         run: 
#           command: \"gulp staging\"
#           name: build-staging
#       - 
#         run: 
#           command: \"ionic state reset\"
#           name: ionic-state-reset
#       - 
#         run: 
#           command: \"npm test\"
#           name: test

Hello @dhavalsoni2001

You have now defined a second job but never defined how it should run in a workflow. Please take a look at our workflow configuration documentation here:

https://circleci.com/docs/2.0/workflows/

Hello, I have this challenge with postman on circleci. my config.yml looks like this.

version: 2.1
orbs:
  newman: postman/newman@0.0.2
jobs:
  build:
    newman-collection-run-env-timeout:
    executor: newman/postman-newman-docker
    steps:
      - checkout
      - newman/newman-run:
          collection: ./collection/new_test.postman_collection.json
          environment: ./env/New-lamp-staging.postman_environment.json

When I deployed to circleci, I got this error

newman

test_reg

❏ auth
↳ Register: 201 Created
  POST https://stagingauth.herokuapp.com/auth/accounts/register/ [415 Unsupported Media Type, 377B, 109ms]
  1. Status code is 201

↳ Register: 400 Bad Request
  POST https://stagingauth.herokuapp.com/auth/accounts/register/ [415 Unsupported Media Type, 377B, 19ms]
  2. Status code is 400

Please what am I doing wrong?

check for content-type header in your son. When you exported your collection, it might not have included hidden headers. If that’s missing in your JSON then this error will appear.
Add content-type header if its missing.

Thank you for this, but can you show me how I can do this? The content type is there on postman alright but it might be hidden like you said.

Go to the Header section, add content-type. Select the appropriate value as per your request.
Save and export the JSON again.
This will resolve if the content type is there in Postman but hidden