简体   繁体   English

您如何组织测试项目

[英]How do you organize your tests projects

I've been following the UnitTest.proj & IntegrationTest.proj per component practice for a while now. 我已经按照每个组件练习学习UnitTest.proj和IntegrationTest.proj已有一段时间了。 However, I'm finding that as my solution grows things start getting messy with all the tests projects etc... Also, I'm exploring some BDD tools so now I may have to add another project (specs) to hold my specifications. 但是,我发现随着解决方案的发展,所有测试项目等都变得一团糟。此外,我还在探索一些BDD工具,因此现在可能不得不添加另一个项目(规格)以保持我的规格。 What I'm thinking about doing is to create one test project per component then have folders and namespaces for Unit / Integration / Specs. 我正在考虑做的是为每个组件创建一个测试项目,然后为Unit / Integration / Specs提供文件夹和名称空间。 The have my build server discriminate on which tests to run based on the namespace. 我的构建服务器根据名称空间来区分要运行哪些测试。 So my CI builds will run Unit*.* and the nightly build will run all of them. 因此,我的CI构建将运行Unit *。*,每晚构建将运行所有它们。 Am I totally crazy here? 我在这里完全疯了吗? I'm interesting in hearing how people organize their test projects. 我很高兴听到人们如何组织他们的测试项目。

Thanks, 谢谢,

In NUnit (and presumably in other test frameworks) you can assign categories to tests. NUnit中 (大概在其他测试框架中),您可以为测试分配类别 This enables you to combine different types of test into a single source file, and pick and choose which types of tests to run. 这使您可以将不同类型的测试组合到一个源文件中,并选择并选择要运行的测试类型。 This is useful if you want to distinguish long-running tests, for example. 例如,如果要区分长时间运行的测试,这将很有用。

You might use this technique to cut down the number of projects you need, even if you choose to keep the same number of test source files. 即使您选择保留相同数量的测试源文件,也可以使用此技术来减少所需的项目数量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM