# Print multiline pm.test name

**URL:** <https://community.postman.com/t/print-multiline-pm-test-name/19702>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [January 29, 2021, 3:32pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702 "2021-01-29T15:32:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Belgi\_TST](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@Belgi\_TST](https://community.postman.com/u/Belgi_TST)\
**Post date:** [January 29, 2021, 3:32pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/1 "2021-01-29T15:32:37Z")

</div>

```auto
pm.test("some string" +res.value +\n+"some string "+res.value) function(){
    iteration of response
});

```

I am not able to print `pm.test()` values in multiline is there any way?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [January 29, 2021, 3:36pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/2 "2021-01-29T15:36:29Z")

</div>

Hey @Belgi_TST

Welcome to the community! 👋

The `Test` name will only be shown on a single line.

What is it that you’re trying to do, there might be an alternative way of achieving this 😃

---

<div class="post-metadata">

**Author:** ![Belgi\_TST](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@Belgi\_TST](https://community.postman.com/u/Belgi_TST)\
**Post date:** [January 29, 2021, 3:45pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/3 "2021-01-29T15:45:03Z")

</div>

ofcourse there is an alternative way… but i want to know is there is any way to get new line feature in test , as because \n is not working

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [January 29, 2021, 3:47pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/4 "2021-01-29T15:47:07Z")

</div>

Simple answer is no 😃

I was trying to establish the reasoning behind wanting to do that - Your question didn’t explain why 😃

---

<div class="post-metadata">

**Author:** ![Belgi\_TST](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@Belgi\_TST](https://community.postman.com/u/Belgi_TST)\
**Post date:** [January 29, 2021, 4:10pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/5 "2021-01-29T16:10:12Z")

</div>

Thank you for the quick reply  
pm.test(“some string” +res.value1 +\n+"some string "+res.value2) function(){  
iteration of response  
});

in this i tried to print two response values in two line . but its showing in same line , both the values

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [January 29, 2021, 5:34pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/6 "2021-01-29T17:34:15Z")

</div>

That’s just repeating the question, rather than explaining why you want to do that in the test name 😃

It will only ever be on a single line, there are no multiple line test names.

---

<div class="post-metadata">

**Author:** ![liangyong.yin](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@liangyong.yin](https://community.postman.com/u/liangyong.yin)\
**Post date:** [December 29, 2021, 3:04am UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/7 "2021-12-29T03:04:38Z")

</div>

I also need to make multiple lines, as there is scroll bar in it and if it is too long, I have to scroll to select the values I want.  
So I need to make it simple, and multiple line can help it.

If we can remove the scroll bar in `Test result` tab, that would resolve this.

---

<div class="post-metadata">

**Author:** ![andreigere](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@andreigere](https://community.postman.com/u/andreigere)\
**Post date:** [October 6, 2022, 8:15pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/8 "2022-10-06T20:15:54Z")

</div>

I don’t think the reasoning matters here. I came across this thread while I was looking myself for a way to output the test result using multi lines.

In my case, I have a loop that gathers a list of names from a json response, and I simply want to see one name by line, instead of all names in a single line, all in the same pm.test().

So, I would like it to be:

John  
Mary  
Gabriel  
Evan

Instead of:

John Mary Gabriel Evan

As the OP stated, using “\n” in the string doesn’t seem to work.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 6, 2022, 8:42pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/9 "2022-10-06T20:42:43Z")

</div>

That’s not main use case of the `pm.test()` method, it _can_ display an output from the response but it’s primarily used to identify the purpose of the assertions within the function.

The Postman Console would be a much more suitable place to log data.

---

<div class="post-metadata">

**Author:** ![andreigere](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@andreigere](https://community.postman.com/u/andreigere)\
**Post date:** [October 6, 2022, 8:58pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/10 "2022-10-06T20:58:39Z")

</div>

I believe what myself and the OP were looking for is a way to visualize output NOT in the console.

After much searching, the solution may be in making use of the pm.visualizer function, as explained here: [Response is not formatted if there are newlines · Issue #8362 · postmanlabs/postman-app-support · GitHub](https://github.com/postmanlabs/postman-app-support/issues/8362#issuecomment-635336207)

In my example above, the names are displayed one per line, since the “\n” is respected in the Visualizer.

This approach allows control over the display output and it can be seen in the right pane, under Body \> Visualize, instead of Test Results.

This may be an even better solution since you can visualize the way you want and still have the Test Results pane for actual tests.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 11, 2022, 1:56pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/11 "2022-10-11T13:56:30Z")

</div>

The visualizer can be used for multiple use-cases.

> **[Visualizing responses | Postman Learning Center](https://learning.postman.com/docs/sending-requests/visualizer/)**
>
> Visualizing responses: documentation for Postman, the collaboration platform for API development. Create better APIs—faster.

My original statement about the `pm.test()` not being the correct place for this output still stands 😃

---

<div class="post-metadata">

**Author:** ![andreigere](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@andreigere](https://community.postman.com/u/andreigere)\
**Post date:** [October 11, 2022, 2:23pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/12 "2022-10-11T14:23:18Z")

</div>

The denial is strong here 🙂

I think the takeaway is that, as a beginner, as I was a few days ago, you look for ways to display results and you think that Tests may be that place because of the convenient placement of the Test Results view in the right pane.

At that point, you probably don’t yet know of the Visualizer, or at least you don’t consider it to be what you need, because the section about it in Learning Postman contains very fancy outputs (with bar charts, heat maps and other graphs) that may not apply when all you want is to see some text.

While the console is a good place to “log” data, it is not meant to separate and display final output, unless you adopt a two console approach, one filtered for logs and errors, the other for info only and you use the console.log and console.info commands accordingly.

But then again, that’s not something you’d know it’s possible as a beginner trying to wrap your mind about how Postman works.

It would be much simpler if Postman had an Output tab right next to the Test Results tab, so you can type something like:

`output.print(loopResults);`

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 11, 2022, 2:51pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/13 "2022-10-11T14:51:48Z")

</div>

I’m not sure what I’m supposed to be denying 🤔

This tab for the visualizer was always there, every time you looked at a response, that contained a link to the documentation. Showing those examples on the documentation is put there to allow folks to know what _might_ be possible

It’s a bigger feature than just using it for your basic use case of displaying data on a new line, start exploring its capabilities and you will very soon realise that covering every example in the documentation would be very difficult.

- [Visualizer - Filter Response Body data using JSONPath](https://community.postman.com/t/visualizer-filter-response-body-data-using-jsonpath/9560)
- [Create and save JSON data files from the Visualizer](https://community.postman.com/t/create-and-save-json-data-files-from-the-visualizer/11357)
- [Copy the request URL to the clipboard - #3 by dannydainton](https://community.postman.com/t/copy-the-request-url-to-the-clipboard/11367/3)

The Postman Console is the _output_ tab - It’s for logging a whole host of things in there, not _just_ data from the response but using that as a means to debug your scripts etc.

Postman is huge and there are so many features that you wouldn’t be exposed to straight away unless you have a specific need to use them. We’re very fortunate to have an awesome community of people that create content about everything that you could possibly do on the platform. We also have the [Learning Center](https://learning.postman.com/docs/getting-started/introduction/), this Community Forum and a great selection of videos on our [YouTube channel](https://www.youtube.com/c/postman)

There are also internal folks like myself who drop into the Community Forum to help unblock users or suggest different solutions to problems.

---

<div class="post-metadata">

**Author:** ![andreigere](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@andreigere](https://community.postman.com/u/andreigere)\
**Post date:** [October 11, 2022, 4:06pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/14 "2022-10-11T16:06:47Z")

</div>

Yes, I noticed there is an amazing community actually, and the more I discover, the more I appreciate all the resources made available by the Postman team.

And yes, after you get familiar enough with the way things work in Postman, things begin to settle in and make sense.

But, before that happens, it “feels” like a dark hole and the little things that more experienced users understand and take for granted are not obvious.

Like the fact that the console is where everything happens is not obvious when you have a “Tests Results” tab right in front of your eyes, that you “think” will display output from the code you write in the Tests tab.

Personally, it took me a while to “get” the collection runner and until then I spent couple of days trying to cook ways to get return values from pm.sendRequest, which I didn’t realize at first were async operations. I thought collections were just folders to organize requests.

The newb brain works like this:

```auto
if ( i type code in tests tab to process query response ) {
      i need to show the output somewhere with line breaks
      if ( to see output in test results i need to use pm.test ){
          i will type everything inside a pm.test()
              ....because otherwise nothing gets displayed in test results and i don't know how else to go about it
      } 
}

```

There are **two main factors** that I believe contribute to the confusion of the beginner:

1. _ **The Visualize tab is empty by default** _

The Visualize tab is nested under Body, alongside other formats (Pretty, Raw, Preview) that will always display something, whereas Visualize is always empty by default. So as you explore the interface to make sense of what see where, you quickly dismiss Visualize because it is always empty alongside the rest of the options which are always not empty.

Because the Visualizer is indeed such a powerful feature that requires intentional configuration through code (unlike Body \> Pretty, Raw and Preview which do not), I think it would be better placed outside of Body and by itself after Test Results (since Test Results is also empty unless intentionally configured to display test results).

Actually, it would be even better if there was a Visualize tab in the main pane (alongside Pre-request Script, Tests), so you know where exactly where you place visualize code (the same way Test Results has its own Tests section).

It doesn’t help either that the visualizer doesn’t have a default template and that pm.visualizer.set **requires** a template parameter (which in turn requires you to have a grasp on Handlebars).

Thus, you can’t just “visualize” with a simple command like `pm.visualize(loopResults)`.

1. _ **The expectation is that post-request logic is handled in the Tests section.** _

I think there may be a design flaw here, due to the expectation to enter code that handles query response in the Tests section. This is because there is nowhere else to enter that code.

Tests should hold only test code.

Any code that handles post-request anything should be entered in a Post-Request Script section, the same way that pre-request code is entered in the Pre-request Script section.

Thus, the main pane would have:

_Params Authorization Headers Pre-request Post-request Visualize Tests Settings_

and the right pane:

Body Cookies Headers Visualize Test Results

* * *

In the end, the console should be the console as it is for many other apps, for logging errors and testing variable values, and not a catch-all solution as it seems to be considered now.

I’d be happy to post this feedback anywhere else Postman accepts suggestions for improvement.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 11, 2022, 5:10pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/15 "2022-10-11T17:10:37Z")

</div>

The visualizer tab should be showing this and not an empty state:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/d/0/d0d680f380952f59f726453605841fe8e8f4ac5b.png)

There are a few things you can get from that, 2 of them being the syntax and where to learn morning about the feature. That does go to the high-level explanation but the basic command structure of it is [on the same page](https://learning.postman.com/docs/sending-requests/visualizer/#adding-visualizer-code)

A default template should be added to the snippets as well as some other helper scripts that are missing, as we have updated the functionality that has fallen behind a little bit.

I agree that `Tests` is a terrible name for that tab, have thought that way for a long time and it should really be called `Post-request Scripts` or something else that conveys what’s happening in that sandbox - And also you can write assertions against the response in there using `pm.test()`

The console isn’t a catch-all solution its usage is exactly how you described and a little more but that feature too has its limitations, as does the visualizer depending on the context and the goal you’re trying to achieve.

---

<div class="post-metadata">

**Author:** ![andreigere](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@andreigere](https://community.postman.com/u/andreigere)\
**Post date:** [October 11, 2022, 5:27pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/16 "2022-10-11T17:27:12Z")

</div>

The Visualize tab for me has always been blank. I’ve never seen it as in your screenshot, which makes more sense.

Here’s screenshot of a simple request that passes a test and that makes no use of pm.visualizer.set anywhere.

 ![postman_visualize_blank](https://us1.discourse-cdn.com/getpostman/original/3X/7/8/787513e29b58766e87dc0e4eeab5c968ac78ab09.jpeg)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 12, 2022, 11:13am UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/17 "2022-10-12T11:13:52Z")

</div>

I don’t know which version of the platform and on what OS you’re using?

---

<div class="post-metadata">

**Author:** ![andreigere](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@andreigere](https://community.postman.com/u/andreigere)\
**Post date:** [October 12, 2022, 6:58pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/18 "2022-10-12T18:58:14Z")

</div>

I am using:

Postman v10.0.25

Windows 10 Pro  
Version 21H2  
OS build 19044.2006  
Experience Windows Feature Experience Pack 120.2212.4180.0

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 12, 2022, 9:28pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/19 "2022-10-12T21:28:14Z")

</div>

Interesting - do you see the same on the Web version?

[https://go.postman.co](https://go.postman.co)

---

<div class="post-metadata">

**Author:** ![andreigere](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@andreigere](https://community.postman.com/u/andreigere)\
**Post date:** [October 12, 2022, 10:47pm UTC](https://community.postman.com/t/print-multiline-pm-test-name/19702/20 "2022-10-12T22:47:23Z")

</div>

Yes, on the web, I see it like in your screenshot.
