51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2235|回复: 0
打印 上一主题 下一主题

Tests In The Spec Before Code?

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2006-2-16 11:59:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
原文链接:http://blogs.msdn.com/micahel/ar ... SpecBeforeCode.aspx


A Diligent Reader writes:

A co-worker and I are having a bit a disagreement that I feel your talents may shed some light on.

We're currently writing an engineering design document which includes a high-level & low-level design of a software component. On completion, this design document is then handed off to another developer (or possibly the same one who wrote the document) to code the design. We've agreed to do a form of TDD where the developer who is coding the design will write the test code before writing any of the component code. We disagree on whether or not to include the high-level & low-level design of the test code in the design document.

My opinion is that the test code is an end product, we need to be clear that the application code is testable upfront, & that we need to know what the tests will/should cover. His opinion is that such information does not need to be included in the design document because it is up to the developer who will be writing the application code to determine what tests to write & how.

Have you ever come across a similar issue? If so, what do you recommend? Thanx.


First off, this isn't TDD. With TDD you write a failing test, write just enough code to make the test pass, then repeat. TDD is all about letting the tests guide the code you write, which in turn affects the tests you write.

Which is not to say their plan of action is a bad idea. It's just not TDD.

I definitely agree that test code is an end product, and that testability needs to be built in to the application from the start. I also agree that knowing what the tests will cover before starting coding is a Very Good Thing.

However, I think the details of the unit tests should be up to the person writing the code. Even if you really do manage to define class details down to the smallest detail (which is usually more trouble than it's worth), once coding actually starts guaranteed things will need to change. The coder needs the freedom to modify the unit tests as necessary to keep up with the code (and vice versa).

What the tests should cover, however, is different than what the tests actually do and how they do it. "What happens when I...?" questions certainly could be part of the design document. In fact, ours are integrated into the feature specification right alongside the other details about the feature.

I also feel compelled to ask whether this team has considered a more agile approach. I find that working in small chunks using just-in-time design works best for me. Many other people and teams have found the same to be true for them as well. I encourage them to look into Agile Programming (http://www.agilealliance.com/) if they haven't already done so.
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-9 10:50 , Processed in 0.069366 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表