Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a npm badge, fixing the UT for InterationRunner. #67

Merged
merged 2 commits into from
May 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Newman [![Build Status](https://travis-ci.org/a85/Newman.svg?branch=master)](https://travis-ci.org/a85/Newman) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)
======
# Newman [![Build Status](https://travis-ci.org/a85/Newman.svg?branch=master)](https://travis-ci.org/a85/Newman) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)
[![NPM](https://nodei.co/npm/newman.png?downloads=true)](https://nodei.co/npm-dl/newman/)

Newman is a command-line collection runner for [Postman](http://getpostman.com). It allows you to effortlessly run and test a Postman collection directly from the command-line. It is built with extensibility in mind so that you can easily integrate it with your continuous integration servers and build systems.

Expand Down
3 changes: 1 addition & 2 deletions src/utilities/ResponseExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ var ResponseExporter = jsface.Class({
* @memberOf ResponseExporter
*/
exportResults: function() {
var exportVariable = this._createExportVariable();

if (Globals.outputFile) {
var exportVariable = this._createExportVariable();
var filepath = path.resolve(Globals.outputFile);
fs.writeFileSync(filepath , JSON.stringify(exportVariable, null, 4));
log.note("\n\n Output Log: " + filepath + "\n");
Expand Down
27 changes: 12 additions & 15 deletions tests/runners/IterationRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,23 @@ describe("IterationRunner", function() {
var filePath = path.join(__dirname, '../', 'data', 'PostmanCollection.json');
var url = "https://www.getpostman.com/collections/fc3f0598daaa5271e4f7";
var options = {iterationCount: 2};
this.emitter = new Emitter();
this.collectionJson = JSON5.parse(fs.readFileSync(filePath, 'utf8'));

this.emitter.removeAllListeners();

this.iterationRunner = new IterationRunner(this.collectionJson, options);
this.spy = sinon.spy(this.iterationRunner, '_runNextIteration');

sinon.stub(RequestRunner, '_execute');
var emitter = new Emitter();
var collectionJson = JSON5.parse(fs.readFileSync(filePath, 'utf8'));
emitter.removeAllListeners();
this.iterationRunner = new IterationRunner(collectionJson, options);
sinon.stub(this.iterationRunner, '_logStatus');
sinon.stub(this.iterationRunner, '_runCollection', function() {
emitter.emit('collectionRunnerOver');
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maa ki kirkiri.. this is all it took? Should have figured this myself 💃

});

it("should call nextIteration for every itertion", function() {
this.iterationRunner._runCollection = function() {
//this.emitter.emit('collectionRunnerOver');
}.bind(this);

//this.iterationRunner.execute();
this.iterationRunner.execute();
assert(this.iterationRunner.iteration, 2);
});

afterEach(function() {
this.iterationRunner._runNextIteration.restore();
this.iterationRunner._logStatus.restore();
this.iterationRunner._runCollection.restore();
});
});