.Net项目的TeamCity增量测试 [英] TeamCity incremental testing for .Net projects

查看:89
本文介绍了.Net项目的TeamCity增量测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个模块化WPF应用程序.每个屏幕都是高度独立和隔离的单元.唯一共享的内容-外壳和具有外观界面的公共库,用于可重复使用的服务(消息总线,持久性,窗口管理等).

I'm building a modular WPF application. Each screen is a highly independent and isolated unit. The only thing shared - shell and a common library with a facade interface for the reusable services (message bus, persistence, window management etc).

由于模块是松散耦合的,因此在更改单个模块时,没有必要重新测试所有内容.我只想测试发生了什么变化.如果公共库中有更改,则应重新测试所有内容.

Since the modules are loosely coupled it doesn't make sense to retest everything when a single module changed. I want to test only what's changed. If there is a change in a common library - everything should be retested.

从源代码控制diff中,您可以轻松获取已更改文件的列表,从而解决受影响的项目(csproj文件列出了所有要编译的文件).您还可以从csproj文件(谁在使用它,谁受到影响)中解决项目依赖关系.所有这些信息应该足以告诉您实际需要测试的内容.因此,这个问题听起来可以解决.

From a source control diff you can easily get a list of files changed and thus resolve the projects affected (csproj files has all the files to compile listed). You can also resolve the project dependencies from the csproj files (who's using it, who's affected). All this info should be enough to tell what actually needs testing. So the problem sounds solvable.

有人用TeamCity做到了吗?有什么建议?我看到有一个针对Java人士的解决方案: http://blog.jetbrains.com/teamcity/2012/03/incremental-testing-with-teamcity/

Has anyone done this with TeamCity? Any suggestions? I saw there is a solution for Java folks: http://blog.jetbrains.com/teamcity/2012/03/incremental-testing-with-teamcity/

.net领域如何?

推荐答案

您必须创建构建配置,并生成人工制品并运行测试.

You have to create build configurations and that generate artefacts and run tests.

例如,您有项目LibraryLibrary.TestsPortablePoratble.TestsAppApp.Tests.

For example you have projects Library, Library.Tests, Portable, Poratble.Tests, App and App.Tests.

您必须创建编译LibraryLibrary.Test项目的构建配置(例如Library build).例如,这种配置会生成伪影. libtests.zip.

You have to create build configuration (eg. Library build) that compiles Library and Library.Test projects. This configuration generates artefactes lets say eg. libtests.zip.

然后创建另一个构建配置(例如Run Library Tests并在先前创建的Library build配置上设置快照和工件依赖关系.在此测试运行配置中,您将libtests.zip文件解压缩(从工件依赖关系中收集)并创建一个构建步骤(例如NUnit运行器)来运行这些测试.

Then you create another build configuration (eg. Run Library Tests and set the snapshot and artefacts dependency on previously created Library build configuration. In this test running configuration you have unpacking the libtests.zip file (gathered from the artefacts dependency) and create a build step (eg. NUnit runner) to run those tests.

请注意:仅当库中的某些内容发生更改时才运行测试,因此请在版本控制设置"下检查Show changes from snapshot dependencies并创建一个新的VCS触发器,该触发器将Trigger on changes in snapshot dependencies(也是一个复选框).

Be careful: You want to run tests only when something changes in Library, so under "Version Control Settings" check the Show changes from snapshot dependencies and create new VCS Trigger that will Trigger on changes in snapshot dependencies (also a checkbox).

然后,假设Portable依赖于Library并具有自己的测试套件.

Then, lets assume Portable is dependent on Library and have its own suite of tests.

同样,您应该创建构建配置,该编译配置将编译项目PortablePortable.Tests并生成称为例如的工件. portabletests.zip

Again, you should create build configuration that will compile projects Portable and Portable.Tests and generate artefacts called eg. portabletests.zip

再一次,您将创建另一个构建配置以运行与先前相同的测试.仅这次,您应该在Build libraryRun library tests配置上添加另一个快照依赖项.通过这种额外的快照依赖性,您将实现仅在库构建和测试运行正常时编译并运行代码.

And yet again you create another build configuration for running this tests the same as previous. only this time you should add another snapshot dependency on Build library and Run library tests configuration. With this additional snapshot dependency you will achieve that code is compiled and run only when library build and testrun is OK.

AppApp.Tests相同.

因此...当库中发生更改时,将重新构建整个集合并运行所有测试(Library.TestsPortable.TestsAppApp.Tests). 当Portable代码中发生更改时,将触发Bulid portables并运行Portable.Tests并重新编译App + App.Tests并运行App.Tests.

So... When change occures in Library the whole set is rebuild and all tests are run (Library.Tests, Portable.Tests, App, App.Tests). When change happens in Portable code, Bulid portables is triggered and Portable.Tests are run and App + App.Tests are recompiles and App.Tests are run.

在此链接上,您可以了解有关teamcity中的快照和人工制品依赖性的更多信息 http://confluence.jetbrains.com/display/TCD8/Configuring+Dependencies

On this link you can learn more about snapshot and artefacts dependencies in teamcity http://confluence.jetbrains.com/display/TCD8/Configuring+Dependencies

这篇关于.Net项目的TeamCity增量测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆