It's fair to say that high code coverage and high performance are not needed for a well-designed unit test?

When developing unit tests, from what I read, you should try to adhere to these principles:

  • Isolate your tests from each other
  • Check only one behavior at a time
  • Make sure the test repeats.

On the other hand, these functions do not always correlate with a good test:

  • High code coverage
  • High performance

Is this a fair approach?

+3
source share
9 answers

. . . () .

+1

, , , , .

, , "", , , , .

+1

- , , , .. , .

, , , . . , ( ), , , -, , . , .

+1

() . , . , ( ) , , .

. , - . , - ; ; . ( ). , - , , , , : ; ; . , , . , , . ; . . . , . .

+1

unit test , unit test . , , .

.

, . , . , Clean Code , . , , assertTrue(hw.heaterState()), assertEquals("HBchL", hw.getState()), , - . - , , .

, , ( 1 ). . , , , , . , , . , , .

/ , . , , ( ). .

+1

:

, . unit test , . , , , , .

0

, , . , .

0

, . "" , .

, , "ba".

0

: unit test 100% . , , . 1%, 100%, , , .

70% -80%, , .

: , unit test, , . , . , . , .

, , 2 . --.

0

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


All Articles