Questions tagged «test-first»

17
您如何对单元测试进行单元测试?[关闭]
已关闭。这个问题是基于观点的。它当前不接受答案。 想改善这个问题吗?更新问题,以便通过编辑此帖子以事实和引用的形式回答。 2年前关闭。 改善这个问题 我正在MVCStoreFront应用程序上观看Rob Connerys的网络广播,我注意到他正在对甚至是最平凡的东西进行单元测试,例如: public Decimal DiscountPrice { get { return this.Price - this.Discount; } } 将进行如下测试: [TestMethod] public void Test_DiscountPrice { Product p = new Product(); p.Price = 100; p.Discount = 20; Assert.IsEqual(p.DiscountPrice,80); } 尽管我全都用于单元测试,但有时我想知道这种形式的测试优先开发是否真的有用,例如,在实际过程中,您的代码上方有3-4层(业务请求,需求文档,体系结构文档) ,可能会误定义实际定义的业务规则(折扣价为价格-折扣)。 如果是这种情况,您的单元测试对您没有任何意义。 此外,单元测试是另一个失败点: [TestMethod] public void Test_DiscountPrice { Product p = new …
89 tdd  agile  test-first 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.