Managing Environment Variable Arrays

Some of the tests I’m running had additive information I’m maintaining over time. Then performing checks against those values when the data has built up and as it’s modified by related methods. Think of it like a booking system where a user can book time against rooms. An awful way of doing this was saving them as environment variables room_one, room_one_start, room_one_end. And then just increment by one for new variables.

This seems a terrible way to do things.

I’ve currently got it implemented with JSON arrays room, start, and end. I’ve also got functions in my globals that can push and pop values and store the results in my env vars. This also doesn’t seem super intuitive.

Is there a better way to do this? I feel like I’m missing something obvious.

Hey @dave.

Could you help me understand the use case slightly better? What is it that you’re trying to optimize?

If you’re simply managing additive data and would like to run certain tests after certain condition (data built up in your example), then I’d recommend looking into branching and looping within Postman, which might help you streamline these flows.

Yes, I’m using looping, it just seems like a lot of overhead and I was hoping there was a better way of doing it. For generic data I’ve created some global functions to help, but for other types I need to do a bit of massaging and custom code.

I was just hoping someone smarter than me had figured out a better, more effective way of doing this.