如何在 TeamCity 中自动执行控制台应用程序的单元测试?

发布于 2024-07-12 08:56:34 字数 289 浏览 9 评论 0原文

我编写了一个控制台应用程序,其中包含许多单元测试,我希望将其包含在我的 nant 构建脚本中,以便它将在我们的 TeamCity CIS 上运行。

不幸的是我不太确定该怎么做。 nant 脚本包含已添加的当前项目的示例...它们都必须提供需要测试的程序集。 即 MyProject.dll 但我的控制台应用程序没有类似的东西,因为它编译成 MyProject.exe

必须有一种方法来自动执行这些测试,因为我能够从 Visual Studio 中毫无问题地运行单元测试。

有谁知道这是否以及如何可能?

I've written a console application that has a number of unit tests and I'm wanting to include it in my nant build script so that it will be run on our TeamCity CIS.

Unfortunately I'm not quite sure how to do that. The nant script has examples of current projects that have been added...they they all have to supply the assemblies that need to be tested. ie MyProject.dll But my console app doesn't have anything like that since it compiles into MyProject.exe

There must be a way to automate these tests since I'm able to run the unit tests from within Visual Studio without issue.

Does anyone know if and how this is possible?

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

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

发布评论

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

评论(3

深者入戏 2024-07-19 08:56:34

这个问题的答案是在添加 DLL 程序集列表的同一位置添加可执行文件的名称。 这组单元测试被编译到可执行文件中,而不是编译到单独的 dll 文件中。

Gishu 应该为这个答案负责......因为他通过评论回答了我......但是,我想将此问题标记为已回答,因此我正在写下答案,以便其他人可以从该解决方案中受益。

Gishu,如果您再次回到这个问题,请随时写下您的评论作为答案,我会将已接受的答案更改为您的答案。

The answer to this question is that you add the name of the executable in the same place you add the list of DLL assemblies. The set of unit tests is compiled into the executable instead of into a separate dll file.

Gishu is the one who should take credit for this answer...since he answered me via a comment...however, I'm wanting to mark this question as answered so I'm writing up the answer so others can benefit from the solution.

Gishu, if you ever come back to this question, please feel free to write up your comment as an answer and I'll change the accepted answer to yours.

甜心 2024-07-19 08:56:34

您使用什么测试框架来进行这些测试? 你提到了Visual Studio,我可能猜它是mstest。 TeamCity 从 4.0 开始为 sln2008 构建运行程序添加了对 MSTest 的支持。

您能否查看受支持的 .NET 单元测试框架的完整列表:
http://www.jetbrains.net/confluence/display /TCD4/.NET+Testing+Frameworks+Support

无论如何,请查看自定义单元测试集成手册页:
http://www.jetbrains.net/confluence/显示/TCD4/Build+Script+Interaction+with+TeamCity

What Test framework do you use for those tests? You've mentioned Visual Studio, I may guess it is mstest. TeamCity added support for MSTest starting from 4.0 for sln2008 build runner.

Could you please have a look to a full list of supported .NET unit test frameworks at
http://www.jetbrains.net/confluence/display/TCD4/.NET+Testing+Frameworks+Support

Any way, have a look to custom unit tests integration manual pages at
http://www.jetbrains.net/confluence/display/TCD4/Build+Script+Interaction+with+TeamCity

少女的英雄梦 2024-07-19 08:56:34

我刚刚注意到 xUnit 标签。 xUnit 支持 TeamCity。 请参阅
http://www.codeplex.com/xunit/WorkItem/View。 WorkItemId=4278
更多细节。

I've just noticed xUnit tag. xUnit supports TeamCity. Please refer to
http://www.codeplex.com/xunit/WorkItem/View.aspx?WorkItemId=4278
for more details.

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