test-first

How to conciliate TDD with SUT interface's contracts?

删除回忆录丶 提交于 2020-01-02 07:28:23
问题 Assuming we are implementing using TDD a Stack class, we would need, for each bit of functionality of our Stack class, to add a new test that exercises it: [TestMethod] public void Should_Be_Empty_After_Instantiation() [TestMethod] public void Should_Not_Be_Empty_After_Pushing_One_Item() ... Now, on the other hand, when doing Unit-Tests, one should focus on what external behaviour our class is supposed to provide, so the set of Unit-Tests check that all the expected contracts for my Stack

Is there a difference between TDD and Test First Development (or Test First Programming)?

点点圈 提交于 2019-12-03 04:41:18
问题 Both ideas sound very similar to me, but there might be subtle differences or the exact same thing, explained in different ways. What is the relationship between TDD and Test First Development/Programming? 回答1: There's a difference in terms of what the driving factor is. Do you have a vague idea of what the class (or system - this can happen at different scales, of course) should look like, then think up tests which give it the actual shape? That's TDD. Do you know exactly what the public API

How do you unit test a unit test? [closed]

﹥>﹥吖頭↗ 提交于 2019-11-29 18:50:19
I was watching Rob Connerys webcasts on the MVCStoreFront App, and I noticed he was unit testing even the most mundane things, things like: public Decimal DiscountPrice { get { return this.Price - this.Discount; } } Would have a test like: [TestMethod] public void Test_DiscountPrice { Product p = new Product(); p.Price = 100; p.Discount = 20; Assert.IsEqual(p.DiscountPrice,80); } While, I am all for unit testing, I sometimes wonder if this form of test first development is really beneficial, for example, in a real process, you have 3-4 layers above your code (Business Request, Requirements

How do you unit test a unit test? [closed]

前提是你 提交于 2019-11-28 13:48:53
问题 I was watching Rob Connerys webcasts on the MVCStoreFront App, and I noticed he was unit testing even the most mundane things, things like: public Decimal DiscountPrice { get { return this.Price - this.Discount; } } Would have a test like: [TestMethod] public void Test_DiscountPrice { Product p = new Product(); p.Price = 100; p.Discount = 20; Assert.IsEqual(p.DiscountPrice,80); } While, I am all for unit testing, I sometimes wonder if this form of test first development is really beneficial,