How do you deal with failed unit tests?

I have a number of projects in the solution file for which there are block tests, and I want to configure them to run our continuous integration server. However, since many of the tests were poorly written and did not run regularly, many of them fail.

I don’t have time to fix all the tests, but I believe that there is value in that the existing tests are performed. What is the best way to deal with failed unit tests?

What I am doing now is to mark each failed test as Explicit and leave a comment to TODO.

[Test, Explicit] //TODO: Rewrite this test because it fails

Is there a better way to do this? Or should I fix all the tests before including them in those tests that are conducted in the CIS?

+3
source share
6 answers

Well, in NUnit, you have the option to ignore tests using the ignore attribute:

[Test, Ignore("Test needs rewrite")]

Personally, however, there are two things that I do with such tests:

  • Remove them if I don’t understand the test, or if the test is outdated / out of sync with current specifications
  • Refactoring to the correct specification if the fix is ​​trivial

Clearing of what you wrote, I would suspect that many of these unsuccessful tests are outdated and may not be relevant in the first place, so I think it would be nice to delete them.

It makes no sense to conduct a test that no one understands.

UPDATE : Oren Eini has a blog post that outlines most of what I feel about activating older, Tests:

:

:

- , . , : " ".

, , .

+6

( !), 5 ( ubuntu):

, ():

if  ( DateTime.now < new DateTime(2008, 12, 24, 11, 00, 00)) return;

5 , . , , , .

, .

+8

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

  • , , . ​​ , .. , , .
  • (, - grep!) ​​ , .
  • , , , . , , ( , ).
+3

, - ...

, , , . , , , , , . , - .

, , , , , .

, , , ? , , ?
+2

, .

? , . . : . , , .

? , , . . , , ...

+1

, ?

TDD ( ), Unit Tests . - . . -, .

, . , . . , , ? .

, . , , . , , .

, , , "" ( ).

0

All Articles