Comparing objects for want and got in tests (test experiment)

Hi everybody!

I’ve recently started using terraform test, and it looks promising, but when one needs to compare created objects - what do you use to compare them?

Any particular package/module or other trick to see what is the exact difference between “want” and “got”? Is there anything that i am missing?

Thank you

Hi @tata2000,

I believe the testing provider already includes both values in its error message when the test fails. Are you saying that the current way it shows the values is difficult to interpret for larger data structures, because it just shows both values rather than showing a difference between them?

If so, indeed that is a limitation of the current experiment. If you can share an example of what you are seeing and perhaps also an example of what might have been more useful to you then I’d be happy to pass that feedback to the Terraform Core product manager for consideration in future iterations of the feature.

I don’t have a good answer for you with the current implementation, though. I think today the best answer would be to compare smaller subsets of your data structure that are easier to interpret in the output, but I know that’s not a very satisfying answer.

Thank you for your answer @apparentlymart
Yes, this is exactly the problem . Without any difference highlighting it is hard to see what is wrong with your object.
Having highlighting in place or a function that comparing 2 objects and returning the diff only - can be very helpful here.
Do you know if the experiment is supposed to become part of the product any time soon? Does it have a development roadmap or was it abandoned?

The terraform test experiment became stalled because the feedback from it was unclear and did not directly answer the question we aimed to solve: is it possible and desirable to write test scenarios declaratively in the Terraform language?

Relatively few people have reported that they’ve tried it and shared their experiences with it in detail. For those that did, the feedback was rather mixed: testing seems to be a rather contentious topic where participants all have strong ideas about what is and is not important to them but many participants have conflicting ideas.

Having a prescribed solution for testing modules remains important to us but the exact requirements for that remain unclear. We are still collecting feedback where people are willing to share it though, and as promised I’m going to share this feedback with our Product Manager. Thanks!

Thank you @apparentlymart
Just as a comment - I saw the message that feedback is expected, and even wanted to submit one, but what exactly you are looking to get the feedback for seemed unclear to me.

It might be helpful to have a structured points that you are looking to get feedback about so people will know what is important .

I’m using it for almost half a year now, will be happy to answer any questions your Product Managers may be having or answer a questioner if you have such.

Thank you!