Foreach not found
See original GitHub issueToday adding a dictionary to a variable in the yml I got a foreach error.
JS Class
var randomName = faker.name.firstName;
var randomLastName = faker.name.lastName;
var addresses = [];
// noinspection JSAnnotator
for( var i = 0; i < faker.random.number(5); i++ ){
var address = new Object();
address.zipcode = faker.address.zipCode();
address.city = faker.address.city();
address.county = faker.address.county();
address.streetName = faker.address.streetName();
address.latitude = faker.address.latitude();
address.long = faker.address.longitude();
addresses.push(address);
}
// console.log(addresses)
userContext.vars.name = randomName;
userContext.vars.lastname = randomLastName;
userContext.vars.address = addresses;
return done();
yml file
config:
target: 'http://127.0.0.1:8000'
http:
timeout: 10
phases:
- duration: 2
arrivalRate: 2
processor: "./specs/PersonsFaker.js"
scenarios:
- name: "Add a person with addresses"
flow:
- function: "addPerson"
- post:
url: "/person/"
json:
firstName: "{{ firstname }}"
lastName: "{{ lastname }}"
address: "{{ address }} "
- log: "Address {{ firstname }}, {{ lastname }}"
This is the output
/node_modules/artillery/lib/commands/run.js:451
scenario.flow.forEach(function(step) {
^
TypeError: Cannot read property 'forEach' of undefined
I updated with the current main branch and nothing is changing.
Repasted the yml file
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Foreach command not found - Ask Ubuntu
I'd previously used the foreach command on older Ubuntu versions without a problem, but now I'm getting "command not found".
Read more >forEach not working when for loop does with an array of objects
forEach iterates over indexes not over properties . ... If you intend to add in the way you are, then just use an...
Read more >Don't use Array.forEach, use for() instead Example - Coderwall
Don't use Array.forEach, use for() instead Example protip about performance, loop, and javascript.
Read more >forEach loop is not working - JavaScript
In this challenge, for loop is working fine. But forEach loop is not. Why so? Your code so far function findElement(arr, func) {...
Read more >Foreach Loop not working - Microsoft Community Hub
Hello I am trying to get a foreach loop to work but when I run the script the way it is in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
scenarios
should be at the top level (same asconfig
)Error - TypeError: scenario.flow.forEach is not a function