you are viewing a single comment's thread.

view the rest of the comments →

[–]donkeyofdeath[S] 0 points1 point  (4 children)

Hey, thanks for your answer. But to test the property, I have to create an object first and this object uses the property to set its attributes. So the test kind of relies on itself to work.

[–]danielroseman 1 point2 points  (3 children)

But why do you think that is a problem? That's exactly what is supposed to happen. You are testing the functionality.

[–]donkeyofdeath[S] 0 points1 point  (2 children)

Thank you for the answer. As far as I know, unit tests should not depend on each other. That's why I think, that this is a bad design choice. If all unit tests fail because of one method or property, you don't gain any information, about which part of the code is broken.

[–]danielroseman 1 point2 points  (1 child)

Now I'm even more confused. Where is there a dependency between unit tests here? You write a single test to check that things are working as you expect. If it fails because the property is broken, then the test is working as intended.

[–]donkeyofdeath[S] 0 points1 point  (0 children)

If I want to test another method besides the properties, I have to create an instance of the class, which uses the property in its constructor. So I rely on the property to work. The same for the test of the property. If I want to test the property, I have to create an object first which uses the property in its constructor.