Is Assert.Fail() considered bad practice?

前端 未结 14 1140
面向向阳花
面向向阳花 2021-01-31 07:20

I use Assert.Fail a lot when doing TDD. I\'m usually working on one test at a time but when I get ideas for things I want to implement later I quickly write an empty test where

相关标签:
14条回答
  • 2021-01-31 07:49

    If you're writing a test that just fails, and then writing the code for it, then writing the test. This isn't Test Driven Development.

    Technically, Assert.fail() shouldn't be needed if you're using test driven development correctly.

    Have you thought of using a Todo List, or applying a GTD methodology to your work?

    0 讨论(0)
  • 2021-01-31 07:49

    Why would you use Assert.Fail for saying that an exception should be thrown? That is unnecessary. Why not just use the ExpectedException attribute?

    0 讨论(0)
提交回复
热议问题