当我添加 NUnit 后,TeamCity 就停止工作了

发布于 2024-08-26 12:52:24 字数 1157 浏览 5 评论 0原文

我在努力让我们的构建服务器运行方面付出了很大的努力。我目前正在 Windows XP 虚拟机中运行测试,并安装了 TeamCity v5.0.3,内部版本 10821。我使用的是 NUnit v2.5.3。

我使用 TeamCity 完成了初始设置,没有任何问题,前提是我使用 sln2008 构建运行程序,这使得整个过程几乎无脑。这样真的很好,并且非常满意地看到您的第一个成功的自动化构建。

现在是时候更上一层楼了,我想让 NUnit 正常工作。我将 NUnit 2.5.3 程序集保存在 SVN 的外部 libs 文件夹中,因此我将其签入测试系统。正如在线说明所建议的那样,我从构建运行程序选项中选择了 NUnit 2.5.3。但是当我构建时,我收到以下错误:

Window1.xaml.cs(14,7): error CS0246: The type or namespace name ‘NUnit’ could not be found (are you missing a using directive or an assembly reference?) 
Window1.xaml.cs(28,10): error CS0246: The type or namespace name ‘Test’ could not be found (are you missing a using directive or an assembly reference?) 
Window1.xaml.cs(28,10): error CS0246: The type or namespace name ‘TestAttribute’ could not be found (are you missing a using directive or an assembly reference?)

一切都在 IDE 中编译得很好。

通过查找博客文章和提交评论,我得到了一些建议并确认了以下内容:

  • 我在项目文件中正确设置了 HintPath 值(指向外部库)
  • 我还可以使用命令行进行完整的发布和调试构建msbuild
  • 我尝试使用 NUnit 安装程序,以便 nunit.framework.dll 注册到 GAC 中。
  • 我已将构建代理的登录帐户更改为测试系统上的用户,而不是本地系统。

似乎没有什么帮助......这里的其他人可以给我一些关于下一步尝试什么的建议吗?

I'm struggling a lot trying to get our build server going. I am currently running tests in a Windows XP virtual machine, and have installed TeamCity v5.0.3, build 10821. I am using NUnit v2.5.3.

I finished the initial setup with TeamCity without any issues at all, provided that I use the sln2008 build runner that makes the entire process almost brainless. It's really quite nice that way, and very satisfying to see your first successful automated build.

Now it's time to kick it up a notch and I wanted to get NUnit working. I keep the NUnit 2.5.3 assemblies in an external libs folder in SVN, so I checked that out onto the test system. I selected NUnit 2.5.3 from the build runner options, as the online instructions had recommended. But when I build, I get the following error:

Window1.xaml.cs(14,7): error CS0246: The type or namespace name ‘NUnit’ could not be found (are you missing a using directive or an assembly reference?) 
Window1.xaml.cs(28,10): error CS0246: The type or namespace name ‘Test’ could not be found (are you missing a using directive or an assembly reference?) 
Window1.xaml.cs(28,10): error CS0246: The type or namespace name ‘TestAttribute’ could not be found (are you missing a using directive or an assembly reference?)

Everything compiles great in the IDE.

From finding blog posts and submitting comments, I got some advice and confirmed the following:

  • I have the HintPath value set properly in my project file (points to the external lib)
  • I can also do a full Release and Debug build from the command line using msbuild
  • I have tried do use the NUnit installer so nunit.framework.dll gets registered into the GAC
  • I have changed the build agent's logon account to be a user on the test system, rather than LOCAL SYSTEM.

Nothing seems to help... can anyone else here offer me some advice on what to try next?

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

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

发布评论

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

评论(1

℉服软 2024-09-02 12:52:24

我已经让它工作了,但不是我真正想要的配置。事实证明,在我的机器上,无论出于何种原因,当我安装 NUnit 2.5.3 时,nunit.framework.dll 并未在 GAC 中注册。

您可以通过输入 gacutil /l | 来解决这个问题。在 VS2008 命令提示符处找到 /i "nunit"。所以我只是用 gacutil /i 安装它。

然后我重新运行 sln2008 构建运行程序,它完成得很好。

我刚刚意识到,当构建完成时,TC 的 NUnit 运行程序未能实际执行任何单元测试。它基本上告诉我“...\bin\debug 不存在”。 ???

不幸的是,我真正需要的是在 GAC 中没有 NUnit 的情况下它也能工作,因为我的所有系统都在保存在 SVN 中的外部 libs 文件夹中引用 nunit.framework.dll。

目前,我的选择是:

  • 确保所有系统都安装了相同版本的 NUnit(也在同一位置?)
  • 让 TeamCity 以某种方式卸载,然后在每次构建时从 SVN 重新安装 nunit.framework.dll

更新

我终于明白了。另一个用户错误...我只查看了简短的日志来尝试确定我的问题,只有在查看了完整日志后我才意识到我到nunit.framework.dll的相对路径是错误的。一旦我这样做了(并且还必须指定所有程序集进行 NUnit 测试),所有内容都会构建并且我的测试现在正在运行。这真是太甜了!

I have gotten this to work, but not in the configuration that I really want. It turns out that on my machine, for whatever reason, when I installed NUnit 2.5.3, nunit.framework.dll was not registered in the GAC.

You can figure this out by entering gacutil /l | find /i "nunit" at the VS2008 command prompt. So I just installed it with gacutil /i.

Then I re-ran the sln2008 build runner, and it completed okay.

I just realized that while the build completed, TC's NUnit runner failed to actually execute any unit tests. It basically told me that the "...\bin\debug doesn't exist". ???

Unfortunately, what I really need is for this to work without NUnit in the GAC, because I have all of my systems referencing nunit.framework.dll in an external libs folder that is saved in SVN.

Currently, my options are:

  • ensure that all systems have the same version of NUnit installed (in the same location, too?)
  • have TeamCity somehow uninstall and then reinstall nunit.framework.dll from SVN every time it does a build

UPDATE

I finally figured it out. Another user error... I only looked at the short log to try to determine my problem, and only after looking at the full log did I realize that my relative path to nunit.framework.dll was wrong. Once I did that (and also had to specify all assemblies to have NUnit test), everything built and my tests are now running. This is pretty sweet!

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