How to find out if your Unit Test Fixture is right?

How do you know if Test Fixture is the right size. And "Test Fixture" I mean a class with a bunch of tests.

One thing that I have always noticed with the help of my test fixtures is that they become kind of verbose; Seeing that they may also not be detailed enough, how do you know when your unit tests are the right size?

My assumption is that (at least in the context of web development) you should have one test fixture class per page.

I know a good quote for this, and this:

"Perfection is achieved, not when there is nothing left to add, but when there is nothing left to remove." - Antoine de Saint-Exupery.

+3
source share
2 answers

This is more relevant to your question, I think:

The metric I use is “Test until you are comfortable” (not sure about the source). I am testing until I feel comfortable that my code is right. If in doubt, you probably have not enough tests. If you think you are wasting your time, you should probably stop.

After re-reading, I think the following does not answer your question:

Test Fixture , , System Under Test: , , , (#). 5-10, , , , . . , , .

+4

, , / . , / , , , / .

, .. , , , , . , , , , , .

+1

Source: https://habr.com/ru/post/1745339/


All Articles