What code should be written in GITLAB to execute my JSON file which is stored in the repository

Hi Team,

I have uploaded my collections in the customized GitLab with the help of the POSTMAN Teams integration plan.
I want to write a code in GitLab (.yml file) which will help to execute my collections.

Can you help me with writing the code in GITLAB for executing my collections?
Please find the screenshot for reference

Thanks in advance :slight_smile:

Adding something like this in a pipeline yml file should get that running in gitlab:

stages:
    - test

newman_tests:
    stage: test
    image:
        name: postman/newman
        entrypoint: [""]
    script:
        - newman run ./your_dir/your_collection.json

Here’s an example project that I use to demo Newman with Gitlab.

1 Like

Hi @danny-dainton ,

Thanks for your quick reply. Will try executing it and will post the results over here.
Thanks a lot :slight_smile:

Regards,
Jagruti Wani

1 Like

Hi @danny-dainton ,

I’m getting the below error-

newman : The term ‘newman’ is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Windows\TEMP\build_script216006556\script.ps1:217 char:1

This is the below code, I’m using the gitlab-ci.yml file

stages:
- test
newman_tests:
stage: test
tags:
- ci
- ssh
image:
name: postman/newman
entrypoint: [“”]
script:
- newman --version
- newman run ./Postman_Collections/APIAutomation.json

Thanks and Regards,
Jagruti Wani

What’s does the actual Gitlab file look like? Not the pasted code from it.

@dannydainton,


Is this what you mean? or do I need to share the complete file?

I’m using shell scripting in gitlab-runner.

The file that contains the workflow script GitLab uses, to know what you would like to run.

I’m using shell scripting in gitlab-runner .

I don’t know what that means, is that something different to the .yml file?

I’m not an expert on all things Gitlab, any knowledge that I have on the CI workflows has come from their documentation.

The pipeline definition provided by @danny-dainton expects you to use a Docker executor, since you have specified a Docker image.

If you don’t wish to use Docker and wish to continue with your shell executor, you need to install all dependencies on your system that runs the GitLab Runner.

I highly recommend using Docker. If you are new to GitLab, use the shared runners from GitLab.com

I’d 100% listen to @vdespa, he knows what he’s talking about. :trophy:

1 Like