Export results with Newman

Hello! Is there a way to export the results of my test while using newman in the same format as postman does when running a collection?

Hey @kxmisis

Welcome to the Postman community! :trophy:

Would you be able to give an example of what type of format you would like?

If it’s a JSON export that you’re after, you can specify that reporter in the Newman command like this -r json

Hi @dannydainton

Thanks for the response! Whenever I export the results of the Postman runner I get a json file like this :

`{
"id": "",
"name": "",
"timestamp": "2020-07-09T10:26:52.533Z",
"collection_id": "",
"folder_id": "",
"environment_id": "",
"totalPass": 9,
"totalFail": 0,
"results": [
	{
		"id": "4425ba59-3309-45de-a927-e1c5540246f3",
		"name": "Correct login",
		"time": 69,
		"responseCode": {
			"code": 200,
			"name": "OK"
		},
		"tests": {
			"Status code is 200": true
		},
		"testPassFailCounts": {
			"Status code is 200": {
				"pass": 3,
				"fail": 0
			}
		},
		"times": [
			466,
			60,
			69
		],
		"allTests": [
			{
				"Status code is 200": true
			},
			{
				"Status code is 200": true
			},
			{
				"Status code is 200": true
			}
		]
	},
	{
		"id": "f151bb67-9509-45e2-9509-b2618da3699e",
		"name": "users",
		"time": 59,
		"responseCode": {
			"code": 200,
			"name": "OK"
		},
		"tests": {
			"Status code is 200": true
		},
		"testPassFailCounts": {
			"Status code is 200": {
				"pass": 3,
				"fail": 0
			}
		},
		"times": [
			61,
			65,
			59
		],
		"allTests": [
			{
				"Status code is 200": true
			},
			{
				"Status code is 200": true
			},
			{
				"Status code is 200": true
			}
		]
	},
	{
		"id": "e39557b2-f0c9-45b7-a863-9cc2ce115f3d",
		"name": "upload transitions",
		"time": 61,
		"responseCode": {
			"code": 400,
			"name": "BAD REQUEST"
		},
		"tests": {
			"Status code is 400": true
		},
		"testPassFailCounts": {
			"Status code is 400": {
				"pass": 3,
				"fail": 0
			}
		},
		"times": [
			66,
			67,
			61
		],
		"allTests": [
			{
				"Status code is 400": true
			},
			{
				"Status code is 400": true
			},
			{
				"Status code is 400": true
			}
		]
	}
],
"count": 3,
"totalTime": 974,
"collection": {
	"requests": [
		{
			"id": "4425ba59-3309-45de-a927-e1c5540246f3",
			"method": "GET"
		},
		{
			"id": "f151bb67-9509-45e2-9509-b2618da3699e",
			"method": "GET"
		},
		{
			"id": "e39557b2-f0c9-45b7-a863-9cc2ce115f3d",
			"method": "POST"
		}
	]
}

}`

Is it possible for newman to create a similar json file? Im particularly interested in the times and the response codes for each test.

Did you check out the built-in JSON reporter that comes with Newman?

I’m not sure of the exact output of that reporter but most of them would expose the same information.