Open jbnok opened 7 years ago
Hmm, this is because the output report has too much of data. This can only be solved by creating a streaming JSON reporter, using something like https://www.npmjs.com/package/stream-json
This is something anyone that's going to performance test an API is going to try... This should be supported out of the box (especially when we're not using this programatically... which is a requirement for the configuration you're suggesting).
This should and must be supported out of the box.
@jbnok, the current reporters are not designed for load testing scenarios, but I can see why it will be useful :+1:
I wrote a reporter that basically just cuts out a bunch of stuff. It cut what was a 92.5 MB report (in the standard JSON reporter) down to 315 KB, while keeping what I consider the important data. This doesn't use a streamer, still JSON.stringify, but I haven't run into the Invalid String Length issue since switching to it. Hopefully this is useful to other people as well: https://www.npmjs.com/package/newman-reporter-json-light
Was running into the same issue. I'll try your reporter out @Paramagnetic !
Same issue here... Would be useful to be able to filter out successful runs.
@Paramagnetic Recently we also got this same issue, and considering there are more people experience the same, have you considered to create a pull request to submit your solution to postman repo? Thank you.
This should be resolved as we add reported flags to trim request and response payloads. But I really like the light JSON reporter. Will recommend your reporter meanwhile. @Paramagnetic
I have installed @Paramagnetic json-light-reporter but how am I supposed to use that? I placed it in newman/lib/reporters and trying: "newman run collection.json --globals globals.json -r newman-reporter-json-light" in the bash console. But "please install reporter using npm" information shows after Enter.
Edit:
Okay, now I have installed global json-light and it's possible to run a collection.
But after finished run, an error appears:
collectionFolder.items.members.forEach(function(folderItem) {
TypeError: Cannot read property 'members' of undefined
Moreover, that doesn't solve the problem with collecting data by node process. Unfortunately, memory occupation by node process is still increasing (to "Javascript heap out of memory")
I would be delighted if there will be an option to NOT store any data and just keep sending an infinite number of queries.
This should be resolved as we add reported flags to trim request and response payloads. But I really like the light JSON reporter. Will recommend your reporter meanwhile. @Paramagnetic
Hello @shamasis, is there any situation update? Is possible to run plenty of requests in single run (limitless run)?
I use big-json to generate the summary.json instead of using JSON.stringify(). It works. The code looks like below.
let bigJson = require('big-json')
function saveBigObjectAsFile(bigObject, filePath) {
const stringifyStream = bigJson.createStringifyStream({
body: bigObject
})
let writeStream = fs.createWriteStream(filePath)
return new Promise((resolve) => {
stringifyStream.on('data', (chunk) => {
writeStream.write(chunk)
})
stringifyStream.on('end', () => {
logger.log('info', 'All data has been saved to %s', filePath)
resolve()
})
})
}
@
This should be resolved as we add reported flags to trim request and response payloads. But I really like the light JSON reporter. Will recommend your reporter meanwhile. @Paramagnetic
This is still an issue while running it in Azure Dev Ops. newman version 5.3.2 running only 2500 iterations.
Version and environment information:
newman -v
): 3.4.3RangeError: Invalid string length at JSON.stringify ()
at EventEmitter. (/usr/local/lib/node_modules/newman/lib/reporters/json/index.js:17:27)
at EventEmitter.emit (/usr/local/lib/node_modules/newman/node_modules/eventemitter3/index.js:151:33)
at done (/usr/local/lib/node_modules/newman/lib/run/index.js:199:29)
at /usr/local/lib/node_modules/newman/node_modules/postman-runtime/lib/backpack/index.js:56:34
at PostmanCollectionRun._process (/usr/local/lib/node_modules/newman/node_modules/postman-runtime/lib/runner/run.js:112:20)
at PostmanCollectionRun. (/usr/local/lib/node_modules/newman/node_modules/postman-runtime/lib/runner/run.js:123:18)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)