# Detailed newman reporter which can be used by "Publish Test Results"

**URL:** <https://community.postman.com/t/detailed-newman-reporter-which-can-be-used-by-publish-test-results/38115>\
**Category:** Help Hub\
**Tags:** newman-project\
**Created:** [August 11, 2022, 9:21am UTC](https://community.postman.com/t/detailed-newman-reporter-which-can-be-used-by-publish-test-results/38115 "2022-08-11T09:21:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![poopedurinal](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@poopedurinal](https://community.postman.com/u/poopedurinal)\
**Post date:** [August 11, 2022, 9:21am UTC](https://community.postman.com/t/detailed-newman-reporter-which-can-be-used-by-publish-test-results/38115/1 "2022-08-11T09:21:58Z")

</div>

_My question_:

Is there a Newman reporter I can use with Azure DevOps that displays request headers, body, status code, and error message? I more or less need the failed test to display all the required information to reproduce it.  
I am familiar with HTML extra, but sadly my CTO will only allow a reporter which can be used with “Publish Test Results” and as far as I know for HTML extra the “Upload Postman HTML Report” extension is required.

_Details (like screenshots)_:

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/1/1d063649c238024b6a05f1b9c1fb5d9d18315fa3.png)

_I’ve already tried_:  
(I use the basic -junit reporter)  
This is my current solution since as far as I can tell the basic junit reporter only displays the test status failed/passed and test name, I have actually put all the information I need into the test name:

But this solution simply looks bad and is awful for writing tests in postman since a large portion of the code is the test name.

> var jsonData=JSON.parse(responseBody);  
> var ReqBody = JSON.stringify(request.data).replaceAll(‘\’,‘’);  
> ReqBody = ReqBody.substring(1,ReqBody.length-1);  
> var ReqHeaders = JSON.stringify(request.headers);  
> var ReqUrl = pm.variables.replaceIn(pm.request.url.toString());
> 
> pm.test(‘\nGet minimal ticket payin.’ + ‘\n\nRequest url:\n’ + request.method + ’ ’ + ReqUrl + ‘\n\nRequest headers:\n’ + ReqHeaders + ‘\n\nRequest body:\n’ + ReqBody + ‘\n\nCode and status:\n’ + JSON.stringify(pm.response.code) + ’ ’ + JSON.stringify(pm.response.status) + ‘\n\n’, function () {  
> pm.response.to.have.status(200);
> 
> ```
> const responseJson = pm.response.json();
> pm.collectionVariables.set("MinPayIn",responseJson.MinPayIn);
> 
> ```
> 
> });

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [August 18, 2022, 10:50am UTC](https://community.postman.com/t/detailed-newman-reporter-which-can-be-used-by-publish-test-results/38115/2 "2022-08-18T10:50:41Z")

</div>

Have you had a look at htmlextra?

[newman-reporter-htmlextra - npm (npmjs.com)](https://www.npmjs.com/package/newman-reporter-htmlextra)

I’ve been playing around with test names , newman and ADO and the test names are important.

What I currently have is the following in the collection level Tests tab. Which runs for all tests.

```auto
// set endpoint to use in test title

const method = pm.info.requestName + " - " + pm.request.url.path.join("/").replace(/^api\//, "");
pm.environment.set("currentMethod", method);

pm.test(`${method} - Status code is 200`, () => {
  pm.response.to.have.status(200);
});

pm.test(`${method} - Response time below 500ms`, () => {
  pm.expect(pm.response.responseTime).to.be.below(500);
});

```

Then for each request, I pull the end point to use in the title.

```auto
//step 1: retrieve end point to include in test title.

var method = pm.environment.get("currentMethod");

```

Then use this in the test title.

```auto
pm.test(`${method} - Short but sweet test name`, () => {

```

You need to ensure your tests are individual, so the test name is relevant.

So considering the following test.

```auto
pm.test(`${method} - Search id eq test`, () => {
    let collectionSearch = (response.DocumentCollections.find(obj => {return obj.id === 'test'}));
    pm.expect(collectionSearch).to.have.property('id');
    pm.expect(collectionSearch).to.be.an('object');
});

```

If you really want to test that its an object, then have this as its own test, so the test case name can be specific.
