-
Notifications
You must be signed in to change notification settings - Fork 121
When iterating a data file, loop back to the beginning... #1218
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
Conversation
...peat the last element
Note: I tried to write a test, but was unsuccessful. I wasn't sure how I could just unit test the getIterationData method without exposing it. I tried
var expect = require('chai').expect,
Waterfall = require('../../lib/runner/extensions/waterfall.command.js');
describe('runner extensions', function () {
describe('Waterfall', function () {
describe('getIterationData', function () {
describe('when iteration count is less than the size of the data', function () {
it('should return the index of the data', function () {
var data = [
{ a: 'b' },
{ c: 'd' },
{ e: 'f' }
];
expect(Waterfall.getIterationData(data, 1)).to.eql({ c: 'd' });
});
});
describe('when iteration count is more than the size of the data', function () {
it('should loop back around to the beginning of the data', function () {
var data = [
{ a: 'b' },
{ c: 'd' },
{ e: 'f' }
];
expect(Waterfall.getIterationData(data, 2)).to.eql({ e: 'f' });
expect(Waterfall.getIterationData(data, 3)).to.eql({ a: 'b' });
expect(Waterfall.getIterationData(data, 5)).to.eql({ e: 'f' });
expect(Waterfall.getIterationData(data, 7)).to.eql({ c: 'd' });
});
});
});
});
});
Codecov Report
@@ Coverage Diff @@ ## develop #1218 +/- ## =========================================== - Coverage 79.57% 79.56% -0.02% =========================================== Files 42 42 Lines 2972 2970 -2 Branches 856 855 -1 =========================================== - Hits 2365 2363 -2 Misses 607 607
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
b5fc76a
to
2717d97
Compare
rather than repeat the last element. For example, take the following data file:
If I were to run a collection with the following GET API: https://postman-echo.com/get?foo1={{inputData}} using the runner, several things happen:
the current behavior is to run once with foo and 4 times with bar. For data seeding, this is not ideal. this enhancement causes the iteration count, if greater than the number of rows in the data, to return to the first index of the data file and continue to invoke the APIs in the collection.
image