VS 2010 Test Runner error “The agent process was s

2019-01-30 00:18发布

In Visual Studio 2010, I have a number of unit tests. When I run multiple tests at one time using test lists, I sometimes reveive the following error for one or more of the tests:

The agent process was stopped while the test was running.

It is never the same test failing, and if I try to run the test again, it succeeds.

I found this bug report on Connect, which seems to be the same problem, but it does not offer a solution.

Has anyone else seen this behaviour ? How I can avoid it ?

Edit

I am still experiencing this bug, and so is many of my colleagues on the same software/hardware setup. I have evaluated the answers so far, but they don't resolve the problem. I am starting a bounty for a solution to this problem.

17条回答
聊天终结者
2楼-- · 2019-01-30 00:54

I have had this happening on the odd occasion, and the culprit almost always turns out to be threading.

Strangely enough all the tests would work fine on the development machines, then randomly fail on the build servers.

On closer inspection it turned out that although the tests were being listed as passed on the dev boxes, there were exceptions being thrown. The exceptions were being thrown on a seperate thread which didn't get picked up as an error.

The exception details were being logged against the test trace, so we were able to identify which code/tests needed to be modified.

Hope this helps someone.

查看更多
仙女界的扛把子
3楼-- · 2019-01-30 00:54

In my case I had some unit-tests for a WCF-service. This WCF service was starting up 2 timers.
Those timers caused side effects.
--> I disable these timers by default and everything is fine!

BTW: I use WCFMock to fake the WCF service, so I have "real" unit tests around my WCF service

查看更多
Root(大扎)
4楼-- · 2019-01-30 00:55

I have run into a similar problem where a test is failing in TestInitialize and is also running code from a ddl from another of my projects. I get the error message as described above and if I try to debug the test, the test is just aborted without any exception details.

I suspect that the problem may be that the dlls from my other project are from a Visual Studio 2012 project and I am running my tests in a VS2010 project, and/or possibly that the UnitTestFramwork dll versions from the 2 projects are mismatched.

查看更多
祖国的老花朵
5楼-- · 2019-01-30 01:01

For finding out where the exception was thrown click on the hyperlink "Test Run Error" next to the exclamation icon in the Test Results window. A window with the stack trace is opened.

This helps a lot to track down the error!

查看更多
再贱就再见
6楼-- · 2019-01-30 01:01

The problem can also be triggered by an Exception or Stackoverflow in Constructor of a TestClass.

查看更多
登录 后发表回答