DannyDainton / newman-reporter-htmlextra

A HTML reporter for Postman's Command Line Runner, Newman. Includes Non Aggregated Runs broken down by Iterations, Skipped Tests, Console Logs and the handlebars helpers module for better custom templates.
Apache License 2.0
357 stars 139 forks source link

[Question] How can I run Newman from the command line? #238

Closed svarshney2311 closed 4 years ago

svarshney2311 commented 4 years ago

Good day. I am new to run Newman. COuld you please tell the steps to execute below command: like if this code has to update anywhere than run command line or ??

const newman = require('newman'); // require newman in your project

// call newman.run to pass options object and wait for callback
newman.run({
collection: require('./sample-collection.json'),
reporters: 'cli'
}, function (err) {
if (err) { throw err; }
console.log('collection run complete!');
});

I have this code but don't know what to do next?

DannyDainton commented 4 years ago

Hey @svarshney2311 ,

This isn't the repo for Newman, that would be https://github.com/postmanlabs/newman

I'm not sure what you're trying to do - Are you just trying to run a Postman collection with Newman from the CLI?

Once you have installed Newman on your machine, the command would be something like this:

newman run https://www.getpostman.com/collections/631643-f695cab7-6878-eb55-7943-ad88e1ccfd65-JsLv

The code that you extracted from the Newman repo is for using Newman as a library in a NodeJS script.

svarshney2311 commented 4 years ago

Could you please share the steps to execute Newman as Library in a Nodejs script.

const newman = require('newman'); // require newman in your project

// call newman.run to pass options object and wait for callback newman.run({ collection: require('./sample-collection.json'), reporters: 'cli' }, function (err) { if (err) { throw err; } console.log('collection run complete!'); });

DannyDainton commented 4 years ago

Something like that I guess:

DannyDainton commented 4 years ago

This isn't really a specific question about the htmlextra reporter, more of a general how do I create a node project.

https://philna.sh/blog/2019/01/10/how-to-start-a-node-js-project/

I'm going to close this issue.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.