Troublesome if statements

Hello do you have any suggestion on how could I implement the scenario below:

Say I have 3 if statements in the test:




And then in one of the iterations, I have param_type that is floating_point_array, how would I prevent postman from executing the content of the second if statement (test 2)?

I keep getting false negative results due to execution of if statements containing conditions that contains partial strings (‘float’) of an iteration.

The use of includes() is necessary to catch cases where:
param_type == 'float_w_status'
So that it can be executed by the test of the second if statement.

Thank you in advance.

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

Hi @mpnistal19,

On seeing the code snippet, you are using include function that will check for the occurrence of the specified keyword in the text. Since float is coming in floating_point_array and simulate_float

In such cases test 2 if condition will result in true. If you are sure that values are distinct and discrete you can use equality operator like the one in below snippet.

if(pm.environment.get('param_type') === 'simulate_float'){



if(pm.environment.get('param_type') === 'float'){



if(pm.environment.get('param_type') === 'floating_point_array'){



If includes is necessary one way can be

if(pm.environment.get('param_type').includes('float') && !pm.environment.get('param_type').includes('floating_point_array')){



Hope it helps :slight_smile:


Thanks for the response darkphoenix, there are some cases where param_type returned is ‘float_w_status’ float with status. And in those cases, it should be handled by tests of the 2nd if statement.

thanks bro. looks like this will solve the problem.