为什么在 TeamCity 中运行测试比在 NUnit 中直接运行需要更长的时间? [英] Why are tests taking longer to run in TeamCity than when run directly in NUnit?

查看:56
本文介绍了为什么在 TeamCity 中运行测试比在 NUnit 中直接运行需要更长的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我进行了一些 C# 性能测试,基本上运行两种不同的方法并检查一种方法是否比另一种运行得快得多.

I have some C# performance tests, basically running two different methods and checking that one runs much faster than the other.

当我在 NUnit 本地运行它们时,其中一个测试的运行速度是另一个的十倍,所以我有一个 NUnit 测试,它使用 Stopwatch 来检查它是否至少是两次一样快(在回归的情况下).但是当我在 TeamCity 中运行测试时,快速方法的速度只有慢速方法的 1.5 倍左右?我希望硬件差异会产生一些影响,但不会有这么多.什么可能导致这种情况?

When I run them locally in NUnit, one of the tests runs ten times as fast as the other, so I've got an NUnit test that uses Stopwatch to check that it is at least twice as fast (in case of regression). But when I run the tests in TeamCity, the fast method is only about 1.5 times as fast as the slow one? I would expect hardware differences to have some effect, but not this much. What could be causing this?

推荐答案

回答我自己的问题,原来问题是TeamCity的测试版本开启了代码覆盖,所以这个开销带来了两个方法运行时更接近.希望这个答案将来能帮助其他人.

To answer my own question, the problem turned out to be that code coverage was turned on for the test build in TeamCity, so the overhead of this brought the two method runtimes closer together. Hopefully this answer helps someone else in future.

这篇关于为什么在 TeamCity 中运行测试比在 NUnit 中直接运行需要更长的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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