Depends on your test framework and continuous integration environment and whether you want to execute your integration tests with your unit tests.
Test frameworks like MbUnit, NUnit and MSTest support the concept of tagging tests with categories, meaning you could indiciate which tests were integration tests by marking them with their own category, ie "Integration". Categories make it possible to keep both sets of tests in the same project but use configuration settings to control which set of tests are run on the build server.
Personally, I like to split them out into separate projects only when necessary. For example, I might split then into their own project if the integration tests required their own special project dependencies or if I wanted to simplify the configuration of the build server such that integration tests are only run periodically.
Depends on the scope of a "project". The integration tests for the components of a single project should be within the project. The tests testing the integration of multiple projects with each other should be a separate project.
我认为 int 测试和单元测试应该是单独的文件。您不知道 SUT 中的类何时会被换出。单独的单元测试减少了所需的重构。
It is my opinion that int tests and unit tests should be separate files. You don't know when a class in your SUT will be swapped out. Separate unit tests reduce the refactoring needed.
发布评论
评论(3)
取决于您的测试框架和持续集成环境以及您是否想要通过单元测试执行集成测试。
MbUnit、NUnit 和 MSTest 等测试框架支持用类别标记测试的概念,这意味着您可以通过用自己的类别(即“集成”)标记哪些测试来指示哪些测试是集成测试。类别使得可以将两组测试保留在同一项目中,但使用配置设置来控制在构建服务器上运行哪组测试。
就我个人而言,我喜欢仅在必要时将它们分成单独的项目。例如,如果集成测试需要自己的特殊项目依赖项,或者如果我想简化构建服务器的配置,以便仅定期运行集成测试,我可能会将其拆分为自己的项目。
Depends on your test framework and continuous integration environment and whether you want to execute your integration tests with your unit tests.
Test frameworks like MbUnit, NUnit and MSTest support the concept of tagging tests with categories, meaning you could indiciate which tests were integration tests by marking them with their own category, ie "Integration". Categories make it possible to keep both sets of tests in the same project but use configuration settings to control which set of tests are run on the build server.
Personally, I like to split them out into separate projects only when necessary. For example, I might split then into their own project if the integration tests required their own special project dependencies or if I wanted to simplify the configuration of the build server such that integration tests are only run periodically.
取决于“项目”的范围。单个项目的组件的集成测试应该在项目内进行。测试多个项目相互集成的测试应该是一个单独的项目。
Depends on the scope of a "project". The integration tests for the components of a single project should be within the project. The tests testing the integration of multiple projects with each other should be a separate project.
我认为 int 测试和单元测试应该是单独的文件。您不知道 SUT 中的类何时会被换出。单独的单元测试减少了所需的重构。
It is my opinion that int tests and unit tests should be separate files. You don't know when a class in your SUT will be swapped out. Separate unit tests reduce the refactoring needed.