VS2005 Team Developer edition SP1 with a test project pointing to a web application with back end classes.
Unit tests were working for quite a while.
One day I started getting the follow error on most of the calls: Test method StudentAdmissionsBooking_Tests.DBAppointmentCalendarTest.getAppointmentTimesTest1 threw exception: System.NullReferenceException: Object reference not set to an instance of an object..
If I cut out all the code in the test class (making it empty) and run the test with the other test classes, they run (except for the other test class that has this same issue).
If I paste the code back into the test class and run the test, it now works fine. I can run it repeatedly without any issue.
When I close the solution, reopen it and attempt to re-run the unit tests, I get the above error again.
We do have multiple developers working on the same solution and possibly updating the same unit tests and the entire solution is checked into source safe. I'm not sure if this makes any difference, but I thought I would mention it just in case.
Bob
Here are the test traces for the time it works vs the time is doesn't:
Failing trace: [V, 1148, 14, 2009/12/14 12:58:01.096 1006053980489901] vstesthost.exe: Time For ControllerTask to queue message: 0 [V, 1148, 14, 2009/12/14 12:58:01.096 1006053980564934] vstesthost.exe: Total Time for controllertask to process message: 0 [V, 1148, 14, 2009/12/14 12:58:01.096 1006053980637510] vstesthost.exe: Time to send TRM to Controller: 0 [V, 1148, 14, 2009/12/14 12:58:01.096 1006053980738427] vstesthost.exe: Dequeing message kind: TestStart [V, 1148, 9, 2009/12/14 12:58:01.096 1006053980783778] vstesthost.exe: ResultQueueThread processing... [V, 1148, 14, 2009/12/14 12:58:01.096 1006053985254996] vstesthost.exe: Broadcasting message kind: TestStart [V, 1148, 9, 2009/12/14 12:58:01.096 1006053985562769] vstesthost.exe: Dequeing message kind: TestEnd [V, 1148, 14, 2009/12/14 12:58:01.096 1006053985513566] vstesthost.exe: Enqueing message kind: TestStart [V, 1148, 14, 2009/12/14 12:58:01.096 1006053986580390] vstesthost.exe: Time For ControllerTask to queue message: 1 [V, 1148, 14, 2009/12/14 12:58:01.096 1006053986659068] vstesthost.exe: Total Time for controllertask to process message: 1 [V, 1148, 14, 2009/12/14 12:58:01.096 1006053986731086] vstesthost.exe: Time to send TRM to Controller: 1 [V, 1148, 9, 2009/12/14 12:58:01.096 1006053988219794] vstesthost.exe: ControllerJob.CallListeners: calling eventListener.ControllerEvent: run id {a04be9b3-2801-474f-955c-ff5766eade80}, test 'appointmentCalendarColNumTest' with id {4816eb8d-39bb-152f-b43e-53a429adeab4}: MessageKind: TestEnd [V, 1148, 9, 2009/12/14 12:58:01.096 1006053989424813] vstesthost.exe: CallListener - user after impersonation: CBEORG\bsleik [I, 1148, 20, 2009/12/14 12:58:01.112 1006054019657496] vstesthost.exe: Using per-test settings for ASP.NET unit test execution [V, 1148, 20, 2009/12/14 12:58:01.112 1006054019914527] vstesthost.exe: WebTestAdapter.ConnectToHostAdapter: adding user 'CBEORG\bsleik' to channel [V, 1148, 20, 2009/12/14 12:58:01.112 1006054019997156] vstesthost.exe: WebTestAdapter.ConnectToHostAdapter: adding user 'CBEORG\bsleik' to channel [V, 1148, 20, 2009/12/14 12:58:01.112 1006054020152577] vstesthost.exe: Sending request to web server to start ASP.NET unit test execution. Url = http://localhost:4769/; Remoting Uri = RegisterHostAdapter1752061c-f413-46b1-8a57-27a68b8eee24/RegisterHostAdapter7aa9fa83-0ae0-486e-a51f-42b3a2fe340f [V, 1148, 9, 2009/12/14 12:58:01.174 1006054164799083] vstesthost.exe: ControllerJob.CallListeners: eventListener.ControllerEvent: success [V, 1148, 9, 2009/12/14 12:58:01.174 1006054165014318] vstesthost.exe: Time to send TRM to HA: 73 [V, 1148, 9, 2009/12/14 12:58:01.174 1006054165156473] vstesthost.exe: Dequeing message kind: TestStart [V, 1148, 9, 2009/12/14 12:58:01.174 1006054165291050] vstesthost.exe: ControllerJob.CallListeners: calling eventListener.ControllerEvent: run id {a04be9b3-2801-474f-955c-ff5766eade80}, test 'getAppointmentTimesTest1' with id {0f357c3a-39ee-3522-64ca-433663dd349d}: MessageKind: TestStart [V, 1148, 9, 2009/12/14 12:58:01.174 1006054166697903] vstesthost.exe: CallListener - user after impersonation: CBEORG\bsleik [V, 1148, 9, 2009/12/14 12:58:01.174 1006054185693222] vstesthost.exe: ControllerJob.CallListeners: eventListener.ControllerEvent: success [V, 1148, 9, 2009/12/14 12:58:01.174 1006054185899331] vstesthost.exe: Time to send TRM to HA: 9 [V, 1148, 9, 2009/12/14 12:58:01.174 1006054185975696] vstesthost.exe: ResultQueueThread waiting... [V, 1148, 9, 2009/12/14 12:58:01.174 1006054186083804] vstesthost.exe: ResultQueueThread processing... [V, 1148, 9, 2009/12/14 12:58:01.174 1006054186156425] vstesthost.exe: ResultQueueThread waiting... [V, 1148, 5, 2009/12/14 12:58:01.408 1006054741858599] vstesthost.exe: Enqueing message kind: RunOutput [V, 1148, 14, 2009/12/14 12:58:01.408 1006054742159217] vstesthost.exe: Dequeing message kind: RunOutput [V, 1148, 14, 2009/12/14 12:58:01.408 1006054742266965] vstesthost.exe: Broadcasting message kind: RunOutput [V, 1148, 14, 2009/12/14 12:58:01.408 1006054742381229] vstesthost.exe: Enqueing message kind: RunOutput [V, 1148, 14, 2009/12/14 12:58:01.408 1006054742463228] vstesthost.exe: Time For ControllerTask to queue message: 0 [V, 1148, 14, 2009/12/14 12:58:01.408 1006054742540754] vstesthost.exe: Total Time for controllertask to process message: 0 [V, 1148, 9, 2009/12/14 12:58:01.408 1006054742589723] vstesthost.exe: ResultQueueThread processing... [V, 1148, 9, 2009/12/14 12:58:01.408 1006054751006820] vstesthost.exe: Dequeing message kind: RunOutput [V, 1148, 9, 2009/12/14 12:58:01.408 1006054751118024] vstesthost.exe: ControllerJob.CallListeners: calling eventListener.ControllerEvent: run id {a04be9b3-2801-474f-955c-ff5766eade80}, test '' with id {00000000-0000-0000-0000-000000000000}: MessageKind: RunOutput [V, 1148, 14, 2009/12/14 12:58:01.408 1006054750873296] vstesthost.exe: Time to send TRM to Controller: 3 [V, 1148, 5, 2009/12/14 12:58:01.408 1006054749202167] vstesthost.exe: Enqueing message kind: Result [V, 1148, 14, 2009/12/14 12:58:01.408 1006054752512754] vstesthost.exe: Dequeing message kind: Result [V, 1148, 14, 2009/12/14 12:58:01.408 1006054752615309] vstesthost.exe: Broadcasting message kind: Result [V, 1148, 14, 2009/12/14 12:58:01.408 1006054752718179] vstesthost.exe: Enqueing message kind: Result [V, 1148, 14, 2009/12/14 12:58:01.408 1006054752796578] vstesthost.exe: Time For ControllerTask to queue message: 0 [V, 1148, 14, 2009/12/14 12:58:01.408 1006054752868776] vstesthost.exe: Total Time for controllertask to process message: 0 [V, 1148, 14, 2009/12/14 12:58:01.408 1006054752945807] vstesthost.exe: Time to send TRM to Controller: 0 [V, 1148, 9, 2009/12/14 12:58:01.424 1006054764932880] vstesthost.exe: CallListener - user after impersonation: CBEORG\bsleik [V, 1148, 9, 2009/12/14 12:58:01.424 1006054766495379] vstesthost.exe: ControllerJob.CallListeners: eventListener.ControllerEvent: success [V, 1148, 9, 2009/12/14 12:58:01.424 1006054766712297] vstesthost.exe: Time to send TRM to HA: 7 [V, 1148, 9, 2009/12/14 12:58:01.424 1006054768693971] vstesthost.exe: Dequeing message kind: Result [V, 1148, 9, 2009/12/14 12:58:01.424 1006054768822032] vstesthost.exe: ControllerJob.CallListeners: calling eventListener.ControllerEvent: run id {a04be9b3-2801-474f-955c-ff5766eade80}, test 'getAppointmentTimesTest1' with id {0f357c3a-39ee-3522-64ca-433663dd349d}: MessageKind: Result, Outcome: Failed [V, 1148, 9, 2009/12/14 12:58:01.424 1006054769959839] vstesthost.exe: CallListener - user after impersonation: CBEORG\bsleik [V, 1148, 9, 2009/12/14 12:58:01.440 1006054803712800] vstesthost.exe: ControllerJob.CallListeners: eventListener.ControllerEvent: success [V, 1148, 9, 2009/12/14 12:58:01.440 1006054804055835] vstesthost.exe: Time to send TRM to HA: 15 [V, 1148, 9, 2009/12/14 12:58:01.440 1006054804136916] vstesthost.exe: ResultQueueThread waiting... [V, 1148, 9, 2009/12/14 12:58:01.440 1006054804218150] vstesthost.exe: ResultQueueThread processing... [V, 1148, 9, 2009/12/14 12:58:01.440 1006054804296261] vstesthost.exe: ResultQueueThread waiting... [V, 1148, 5, 2009/12/14 12:58:01.440 1006054812566649] vstesthost.exe: Request for running ASP.NET test finished successfully. Url = http://localhost:4769/ [V, 1148, 17, 2009/12/14 12:58:01.440 1006054817413734] vstesthost.exe: Enqueing message kind: TestEnd [V, 1148, 14, 2009/12/14 12:58:01.440 1006054817656590] vstesthost.exe: Dequeing message kind: TestEnd [V, 1148, 14, 2009/12/14 12:58:01.440 1006054817751171] vstesthost.exe: Broadcasting message kind: TestEnd [V, 1148, 14, 2009/12/14 12:58:01.440 1006054817863545] vstesthost.exe: Enqueing message kind: TestEnd [V, 1148, 9, 2009/12/14 12:58:01.440 1006054817947542] vstesthost.exe: ResultQueueThread processing... [V, 1148, 9, 2009/12/14 12:58:01.440 1006054818037110] vstesthost.exe: Dequeing message kind: TestEnd [V, 1148, 9, 2009/12/14 12:58:01.440 1006054818152454] vstesthost.exe: ControllerJob.CallListeners: calling eventListener.ControllerEvent: run id {a04be9b3-2801-474f-955c-ff5766eade80}, test 'getAppointmentTimesTest1' with id {0f357c3a-39ee-3522-64ca-433663dd349d}: MessageKind: TestEnd [V, 1148, 9, 2009/12/14 12:58:01.440 1006054819415082] vstesthost.exe: CallListener - user after impersonation: CBEORG\bsleik [V, 1148, 9, 2009/12/14 12:58:01.440 1006054821485631] vstesthost.exe: ControllerJob.CallListeners: eventListener.ControllerEvent: success [V, 1148, 9, 2009/12/14 12:58:01.440 1006054822026783] vstesthost.exe: Time to send TRM to HA: 2 [V, 1148, 9, 2009/12/14 12:58:01.440 1006054822667340] vstesthost.exe: ResultQueueThread waiting... [V, 1148, 14, 2009/12/14 12:58:01.440 1006054822367973] vstesthost.exe: Time For ControllerTask to queue message: 1 [V, 1148, 14, 2009/12/14 12:58:01.440 1006054823303199] vstesthost.exe: Total Time for controllertask to process message: 2 [V, 1148, 14, 2009/12/14 12:58:01.440 1006054823381985] vstesthost.exe: Time to send TRM to Controller: 2
Working Trace: [V, 2476, 17, 2009/12/14 13:00:13.820 1006372211295249] vstesthost.exe: Enqueing message kind: TestStart [V, 2476, 9, 2009/12/14 13:00:13.820 1006372211373090] vstesthost.exe: ResultQueueThread processing... [V, 2476, 9, 2009/12/14 13:00:13.820 1006372213073523] vstesthost.exe: Dequeing message kind: TestEnd [V, 2476, 9, 2009/12/14 13:00:13.820 1006372213189902] vstesthost.exe: ControllerJob.CallListeners: calling eventListener.ControllerEvent: run id {ebebd901-91a9-40d9-8580-e4200f9b8e21}, test 'LanguageNameTest' with id {40ea3c98-e36b-d79a-8161-b4d57fc6e4bd}: MessageKind: TestEnd [V, 2476, 14, 2009/12/14 13:00:13.820 1006372211345622] vstesthost.exe: Time For ControllerTask to queue message: 0 [V, 2476, 14, 2009/12/14 13:00:13.820 1006372213473042] vstesthost.exe: Total Time for controllertask to process message: 1 [V, 2476, 14, 2009/12/14 13:00:13.820 1006372213551108] vstesthost.exe: Time to send TRM to Controller: 1 [V, 2476, 14, 2009/12/14 13:00:13.820 1006372213648893] vstesthost.exe: Dequeing message kind: TestStart [V, 2476, 14, 2009/12/14 13:00:13.820 1006372213734879] vstesthost.exe: Broadcasting message kind: TestStart [V, 2476, 14, 2009/12/14 13:00:13.820 1006372213829001] vstesthost.exe: Enqueing message kind: TestStart [V, 2476, 14, 2009/12/14 13:00:13.820 1006372215492093] vstesthost.exe: Time For ControllerTask to queue message: 1 [V, 2476, 14, 2009/12/14 13:00:13.820 1006372215567495] vstesthost.exe: Total Time for controllertask to process message: 1 [I, 2476, 23, 2009/12/14 13:00:13.820 1006372214152218] vstesthost.exe: Using per-test settings for ASP.NET unit test execution [V, 2476, 14, 2009/12/14 13:00:13.820 1006372215814464] vstesthost.exe: Time to send TRM to Controller: 1 [V, 2476, 9, 2009/12/14 13:00:13.820 1006372214407125] vstesthost.exe: CallListener - user after impersonation: CBEORG\bsleik [V, 2476, 23, 2009/12/14 13:00:13.820 1006372215968760] vstesthost.exe: WebTestAdapter.ConnectToHostAdapter: adding user 'CBEORG\bsleik' to channel [V, 2476, 23, 2009/12/14 13:00:13.820 1006372216112175] vstesthost.exe: WebTestAdapter.ConnectToHostAdapter: adding user 'CBEORG\bsleik' to channel [V, 2476, 23, 2009/12/14 13:00:13.820 1006372216236861] vstesthost.exe: Sending request to web server to start ASP.NET unit test execution. Url = http://localhost:4971/; Remoting Uri = RegisterHostAdapterb7ed6e7c-4627-46ff-a38b-b5e59e523e10/RegisterHostAdapterb8d19f4a-6257-48b0-8990-976bae9bc81f [V, 2476, 9, 2009/12/14 13:00:13.835 1006372226097945] vstesthost.exe: ControllerJob.CallListeners: eventListener.ControllerEvent: success [V, 2476, 9, 2009/12/14 13:00:13.835 1006372226262375] vstesthost.exe: Time to send TRM to HA: 5 [V, 2476, 9, 2009/12/14 13:00:13.835 1006372226373669] vstesthost.exe: Dequeing message kind: TestStart [V, 2476, 9, 2009/12/14 13:00:13.835 1006372226472579] vstesthost.exe: ControllerJob.CallListeners: calling eventListener.ControllerEvent: run id {ebebd901-91a9-40d9-8580-e4200f9b8e21}, test 'getAppointmentTimesTest1' with id {0f357c3a-39ee-3522-64ca-433663dd349d}: MessageKind: TestStart [V, 2476, 9, 2009/12/14 13:00:13.835 1006372227628782] vstesthost.exe: CallListener - user after impersonation: CBEORG\bsleik [V, 2476, 9, 2009/12/14 13:00:13.835 1006372229343489] vstesthost.exe: ControllerJob.CallListeners: eventListener.ControllerEvent: success [V, 2476, 9, 2009/12/14 13:00:13.835 1006372229465187] vstesthost.exe: Time to send TRM to HA: 2 [V, 2476, 9, 2009/12/14 13:00:13.835 1006372231155288] vstesthost.exe: ResultQueueThread waiting... [V, 2476, 9, 2009/12/14 13:00:13.835 1006372231259805] vstesthost.exe: ResultQueueThread processing... [V, 2476, 9, 2009/12/14 13:00:13.835 1006372231331292] vstesthost.exe: ResultQueueThread waiting... [V, 2476, 5, 2009/12/14 13:00:14.039 1006372736014518] vstesthost.exe: Enqueing message kind: RunOutput [V, 2476, 14, 2009/12/14 13:00:14.039 1006372736261028] vstesthost.exe: Dequeing message kind: RunOutput [V, 2476, 14, 2009/12/14 13:00:14.039 1006372736359164] vstesthost.exe: Broadcasting message kind: RunOutput [V, 2476, 14, 2009/12/14 13:00:14.039 1006372736468001] vstesthost.exe: Enqueing message kind: RunOutput [V, 2476, 9, 2009/12/14 13:00:14.039 1006372736557749] vstesthost.exe: ResultQueueThread processing... [V, 2476, 9, 2009/12/14 13:00:14.039 1006372736646759] vstesthost.exe: Dequeing message kind: RunOutput [V, 2476, 9, 2009/12/14 13:00:14.039 1006372736747172] vstesthost.exe: ControllerJob.CallListeners: calling eventListener.ControllerEvent: run id {ebebd901-91a9-40d9-8580-e4200f9b8e21}, test '' with id {00000000-0000-0000-0000-000000000000}: MessageKind: RunOutput [V, 2476, 9, 2009/12/14 13:00:14.039 1006372738005849] vstesthost.exe: CallListener - user after impersonation: CBEORG\bsleik [V, 2476, 9, 2009/12/14 13:00:14.039 1006372738943037] vstesthost.exe: ControllerJob.CallListeners: eventListener.ControllerEvent: success [V, 2476, 9, 2009/12/14 13:00:14.039 1006372739038401] vstesthost.exe: Time to send TRM to HA: 1 [V, 2476, 9, 2009/12/14 13:00:14.039 1006372739116539] vstesthost.exe: ResultQueueThread waiting... [V, 2476, 14, 2009/12/14 13:00:14.039 1006372739197278] vstesthost.exe: Time For ControllerTask to queue message: 1 [V, 2476, 14, 2009/12/14 13:00:14.039 1006372739275524] vstesthost.exe: Total Time for controllertask to process message: 1 [V, 2476, 14, 2009/12/14 13:00:14.039 1006372739345859] vstesthost.exe: Time to send TRM to Controller: 1 [V, 2476, 5, 2009/12/14 13:00:14.054 1006372742618790] vstesthost.exe: Enqueing message kind: Result [V, 2476, 14, 2009/12/14 13:00:14.054 1006372742773815] vstesthost.exe: Dequeing message kind: Result [V, 2476, 14, 2009/12/14 13:00:14.054 1006372742938488] vstesthost.exe: Broadcasting message kind: Result [V, 2476, 14, 2009/12/14 13:00:14.054 1006372743046704] vstesthost.exe: Enqueing message kind: Result [V, 2476, 14, 2009/12/14 13:00:14.054 1006372743126660] vstesthost.exe: Time For ControllerTask to queue message: 0 [V, 2476, 14, 2009/12/14 13:00:14.054 1006372743197481] vstesthost.exe: Total Time for controllertask to process message: 0 [V, 2476, 14, 2009/12/14 13:00:14.054 1006372743270939] vstesthost.exe: Time to send TRM to Controller: 0 [V, 2476, 9, 2009/12/14 13:00:14.054 1006372743308775] vstesthost.exe: ResultQueueThread processing... [V, 2476, 9, 2009/12/14 13:00:14.054 1006372746186309] vstesthost.exe: Dequeing message kind: Result [V, 2476, 9, 2009/12/14 13:00:14.054 1006372746338625] vstesthost.exe: ControllerJob.CallListeners: calling eventListener.ControllerEvent: run id {ebebd901-91a9-40d9-8580-e4200f9b8e21}, test 'getAppointmentTimesTest1' with id {0f357c3a-39ee-3522-64ca-433663dd349d}: MessageKind: Result, Outcome: Passed [V, 2476, 9, 2009/12/14 13:00:14.054 1006372747793061] vstesthost.exe: CallListener - user after impersonation: CBEORG\bsleik [V, 2476, 9, 2009/12/14 13:00:14.054 1006372764603945] vstesthost.exe: ControllerJob.CallListeners: eventListener.ControllerEvent: success [V, 2476, 9, 2009/12/14 13:00:14.054 1006372764819036] vstesthost.exe: Time to send TRM to HA: 8 [V, 2476, 9, 2009/12/14 13:00:14.054 1006372764904770] vstesthost.exe: ResultQueueThread waiting... [V, 2476, 5, 2009/12/14 13:00:14.085 1006372827722304] vstesthost.exe: Request for running ASP.NET test finished successfully. Url = http://localhost:4971/ [V, 2476, 17, 2009/12/14 13:00:14.085 1006372831410558] vstesthost.exe: Enqueing message kind: TestEnd [V, 2476, 14, 2009/12/14 13:00:14.085 1006372831610439] vstesthost.exe: Dequeing message kind: TestEnd [V, 2476, 14, 2009/12/14 13:00:14.085 1006372831718817] vstesthost.exe: Broadcasting message kind: TestEnd [V, 2476, 14, 2009/12/14 13:00:14.085 1006372831834242] vstesthost.exe: Enqueing message kind: TestEnd [V, 2476, 14, 2009/12/14 13:00:14.085 1006372831916520] vstesthost.exe: Time For ControllerTask to queue message: 0 [V, 2476, 14, 2009/12/14 13:00:14.085 1006372831988403] vstesthost.exe: Total Time for controllertask to process message: 0 [V, 2476, 14, 2009/12/14 13:00:14.085 1006372833972003] vstesthost.exe: Time to send TRM to Controller: 1
Moved byFigo FeiTuesday, December 15, 2009 4:37 AM (From:Visual Studio Team System - Testing)
I'm sorry to hear you're having trouble with your unit tests. I do have to say, that we completely re-wrote the way test are executed in the 2008 version, so I would strongly suggest moving to the newer version, I'm pretty sure this issue will be fixed.
Thanks, David Gorena Elizondo MSFT Visual Studio Team Test
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.