Pm.test with variables in testName?

I’m testing nested array and would like to know at what intersection they pass / fail.
a = first level array (from a for loop)
b = nested array (from b for loop)

looking to get test output like:
pm.test(“At a step b is not NULL”, function () {

Thanks for the help.

pm.test(`At ${a} step ${b} is not NULL`, function() {

Interpolation requires backticks (`) around the text you want to use.

You can always use the old way of concatenation, but it’s ugly and sucks to write.

pm.text(“At " + a + " step " + b " + " is not NULL”, function() {

I used to do this and I would advise against it.

It becomes a headache when debugging if those values/properties aren’t present in the response because the test name would show:

"At undefined step undefined is not NULL"
1 Like

I agree with Paul, I have suggested doing this in the past but for values that I know that were going to be there. Gets a bit messy when you are trying to do something like this with it.

1 Like