By saying = true you are saying that the test will always pass.
If you’re looking to check the count against a specific value, your test should look more like:
tests["Items length is greater than or equal to 3"] = pm.response.json().items.length >= 3;
The format for writing tests in Postman has changed from this older syntax, so it’d be worth checking out how tests can be written now. It follows a chai pattern which might be more familiar to you: https://learning.getpostman.com/docs/postman/scripts/test_examples
Correct, I want my test to ALWAYS show as passed, its just getting the correct count of the nested array of objects that postman and I are struggling with.
I see. Are you able to provide more details on what the array looks like when it becomes ‘too large’ to be accurate? The functionality you are using is the built-in method of JS for determining length of a string/array, so it’s likely that the structure of the array at a larger size is not what you’re expecting. Perhaps it’s a 2D array rather than just an array of objects?
Structure is exactly how i posted just with a greater number of objects, ie. items array has 200 objects which also have around 20 key,values with some objects nested. I only want the count of objects in the items array, so below would still return 3:
Perhaps you can paste an example of the large array on https://pastebin.com/ so we can evaluate it? If you let us know how many items you think are in the array that will allow us to check…
Just to be clear, you aren’t expecting this to count recursively… i.e. count every object inside any other object too?