TDD 需要基础设施吗?

发布于 2024-08-14 16:18:34 字数 1579 浏览 4 评论 0原文

我对单元测试和 TDD “相对较新”。直到最近,我才完成了我的第一个生产应用程序,它(至少在理论上)具有 100% 的代码覆盖率。我在之前的项目中也做过单元测试一段时间,但不是以真正的 TDD 方式进行,也没有良好的代码覆盖率。这一直是事后的想法。我觉得我现在已经很好地掌握了它。

我还尝试对团队的其他成员进行 TDD 和单元测试方面的培训,以便我们能够共同成长并开始在所有应用程序中进行单元测试,并最终进展到使用自动化构建和测试来进行完整的 TDD。持续集成。我发布了 这里有一个主题,关于我的攻击计划/培训议程,以供评论和讨论。批评。

其中一条回复(实际上是投票最高的)建议我在继续培训之前首先设置基础设施。不幸的是,我没有接触过这一点,并且在谷歌上搜索这些主题很困难,因为 CruiseControl.NET / nAnt / 等的页面并没有真正解释我们应该设置它的“原因”以及一切“如何”连接在一起。

我们是一家小商店(大约 10 名开发人员),几乎完全使用微软技术并在 VB.NET 中进行开发。我们希望最终开始使用 C#,但那是另一个时间了。我一直在使用 VS2008 附带的 MSTest 项目进行单元测试,并且一直在使用 Visual Studio 构建应用程序,并使用 MSI 安装项目进行部署...我们还(不幸的是)使用 VSS 进行源控制 -但这也在砧板上,我真的很想摆脱它并使用颠覆。

我知道我需要使用 CruiseControl.NET 进行 CI,并使用 nAnt 或 MSBuild 来构建应用程序。我可能需要一个构建服务器来运行所有这些构建。但我只是找不到任何东西可以“连接”这些点并解释它们如何彼此交互,构建服务器上应该有什么,何时应该使用构建服务器进行构建(是否仅用于部署构建,甚至当您只是想在本地环境中进行一些小更改后编译您正在开发的应用程序?)。我还计划取消 MSTest,因为我发现它有问题,并将改用 nUnit。

任何人都可以阐明我从“知道如何进行 TDD”到“建立适当的基础设施以便整个团队可以做到这一点并一起工作”之间的差距吗?我确实理解什么是持续集成,但同样,我不确定应该如何设置构建服务器以及它如何与所有内容连接,以及为什么我们需要一个(例如向管理层推销)。

非常感谢您抽出时间。

我需要 Finalbuilder 的哪一部分? 看起来 Final builder 和 teamcity 有一些重叠。 Finalbuilder 服务器似乎是 CI 服务器,所以我猜我不需要它。 FinalBuilder 似乎是一个构建服务器 - 但我认为 TeamCity 也是一个构建服务器...而 Automise 似乎是一个可视化 Windows 自动化工具,就像某种 winforms 应用程序的开发平台...

_我也不知道在 Team City 支持的应用程序图表中查看对最终构建器的支持: _

I am 'relatively new' to unit-testing and TDD. Only more recently have I completed my first production application that has (at least in theory) 100% code coverage. I have done unit-testing in previous projects as well for some time, but not in true TDD fashion and with good code coverage. It had always been an after-thought. I feel I have a pretty good grasp on it now though.

I'm also trying to train the rest of the team on TDD and unit testing so that we can grow togeather and start moving forward with doing unit testing in all of our applications, and eventually progress to doing full TDD w/ automated builds & continous integration. I posted a thread here regarding my plan of attack / training agenda for comments & critisism.

One of the replies (in fact the highest voted) suggested I first setup infrastructure before I go forward with the training. Unfortunately I have no exposure to this, and googling on the topics is difficult because the pages for CruiseControl.NET / nAnt / etc do not really explain the 'why' we should set this up and the 'how' everything connects togeather.

We are a small shop (about 10 developers) and use almost exclusively microsoft technologies and do our development in VB.NET. We are looking to eventually start using C# but that's for another time. I've been using the MSTest project that comes with VS2008 for my unit tests, and I've been building my apps using Visual Studio, and deploying using MSI setup projects... We also (unfortunately) use VSS for our soure control - but that is also on the chopping block and I'd really like to get rid of it and use subversion.

I know that I need to use CruiseControl.NET for CI, and either nAnt or MSBuild for building the applications. And I probably need a build server to run all these builds. But I just can't find anything that 'connects' the dots and explains how they interact with eachother, what should be on your build server, when you should build with your build server (is it just for deployment builds, or even when you just want to compile the app you're developing after making a small change, on your local environment?). I'm also planning on axing MSTest as I've found it to be buggy and will use nUnit instead.

Can anyone perhaps illuminate this gap I have from 'knowing how to do TDD' to 'setting up the proper infrastructure so the whole team can do it and work togeather'? I do understand what continous integration is, but again, I'm not sure how a build server should be setup and how it connects with everything, and why we need one (e.g. the pitch to management).

thanks very much for your time.

What portion of finalbuilder do I need? It seems there's some overlap with final builder and teamcity. Finalbuilder server seems to be a CI server, so I'm guessing I don't need that. FinalBuilder seems to be a build server - but I thought TeamCity is also a build server... And Automise seems to be a visual windows automation tool, like some kind of development platform for winforms apps...

_I also don't see support for final builder in The Team City Supported Apps Diagram : _

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无妨# 2024-08-21 16:18:34

看一下我几周前举办的网络研讨会 - 如何成功开始单元测试。在那次网络研讨会中,我讨论了工具和单元测试最佳实践,它针对的是像您一样想要在其组织中引入单元测试的开发人员。

您想要建立 CI(持续集成)流程的首要任务是,为此您需要三个工具:

  1. 源代码控制
  2. 构建服务器
  3. 构建客户端/脚本

我希望您已经有了某种形式的源代码控制,所以让我们谈谈关于另外两个。

构建服务器 - 检查源代码控制,当它更改(或满足其他条件)时,在某些客户端(或同一台计算机)上运行构建脚本,有多个可用的构建服务器,我推荐 JetBrain 的 TeamCity 它易于安装和使用(出色的 Web 界面),并且免费供最多 20 名开发人员(即您)使用。

构建脚本 - 在构建客户端上,您希望运行一个构建脚本来构建您的解决方案并运行单元测试。 TeamCity 有一些基本的构建和构建测试功能,但对于更高级的选项(构建安装程序、文档等),您在工作中需要一些脚本运行程序,我们使用 FinalBuilder - 它不是免费的,但有非常好的编辑器。如果您正在寻找免费的替代方案,请查看 ANTNANT - 但要准备好编辑大量 XML。

其他工具 - 因为成功的单元测试的一个重要部分是在开发人员的机器上编写和运行测试的容易程度,所以我建议您检查是否有更好的 IDE 或外部工具可以帮助开发人员编写&运行他们的单元测试。

Take a look at a webinar I did a few weeks ago - How To Start Unit Testing Successfully. In that webinar I've talked about tools and unit testing best practices and it was aimed at developers just like you who want to introduce unit testing in their organization.

First order of business you want to put a CI (Continuous Integration) process in place and for that you'll need three tools:

  1. Source control
  2. Build server
  3. Build client/script

I hope you already have some form of source control in place so let's talk about the other two.

Build Server - checks the source control and when it changes (or some other condition met) runs a build script on some client (or same machine) there are several build server available I recommend JetBrain's TeamCity it's easy to install and use (great web interface) and is free for up to 20 developers (that's you).

Build Script - on your build client you want to run a build script that would build your solution and run your unit tests. TeamCity has some basic build & test capabilities but for more advanced options (build installer, documentation etc.) you'll need some script runner at work we use FinalBuilder - it's not free but has very good editor. If you're looking for a free alternative have a look at ANT or NANT - but be prepared to edit a lot of XML.

Other tools - Because an important part of successful unit testing is how easy it is to write and run tests on the developer's machines I suggest you check if there are better IDE's or external tools that would help the developers write & run their unit tests.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文