Answered Unit testing is not stopping

  • Wednesday, July 25, 2012 12:53 PM
     
     

    I created a couple basic methods and created TestProject. When I run test it is running for a long time and impossible to stop. I have to restart my Visual Studio(VS2010 Ultimate). Methods are very simple. 

    public int Plus(int a, int b)

    {

           return a+b;

    }

    Thanks


    Dilshod

All Replies

  • Wednesday, July 25, 2012 1:33 PM
     
     

    Where is the test method attribute. 

    Anything logged in the event viewer?

    Look at this walkthrough on how to create a unit test and run it http://msdn.microsoft.com/en-us/library/ms182532.aspx 


    Please remember to mark the replies as answers if they help.

    Tarun Arora

    Blog: http://geekswithblogs.net/TarunArora  Subscribe in a reader


    Facebook: Visual Studio Bytes

    Videos: ALM Videos

  • Wednesday, July 25, 2012 2:47 PM
     
     

    I Exactly follow this thing before, but it didn't work. Even I tried very sample code, it didn't work.

    Thanks,

    Dilshod

  • Thursday, July 26, 2012 7:17 AM
    Moderator
     
     

    Hi dkcorp,

    Thank you for posting in MSDN forum.

    For this problem, maybe there is something wrong with your Visual Studio or your machine's performance. You can monitor the Task Manager to see the memory or CPU usage of devenv.exe. 

    If Devenv.exe takes too much memory and CPU,

    you can shut up some other processes which are running at the same time to reduce  CPU  load then recreate  a new test project to run to see if it can reproduce the issue .

    Or you can try to use Devenv.exe/SafeMode  in VS Command Prompt  to run the test to  prevent all third-party VSPackages from loading when Visual Studio starts, thus ensuring stable execution.

    And you also check your VS setting which may cause some problems.

    I hope this will be helpful to you. 

    Thanks,

    Amanda

  • Thursday, July 26, 2012 12:14 PM
     
     

    Yes I tried to do same thing in other machine it did work. I don't know whats wrong with my machine.

    Thanks!


    Dilshod

  • Monday, August 06, 2012 8:26 PM
     
     

    Hi everyone,

    I tried to reinstall my Visual Studio, but I still have that problem. When I click on run test it says pending and I have to restart Visual Studio to stop it. I am running Visual Studio on Windows Server 2008 R2.

    Thanks for help!


    Dilshod

  • Friday, August 10, 2012 8:41 AM
    Moderator
     
     Answered
    Hi dkcorp,
    Sorry for my delay.
    Before you reinstall your Visual Studio, you need to make sure you have uninstalled Visual Studio completely. And you can check if you have installed the SP1. Also I would like to know if you have two or more Visual Studios on your computer. If so, it may cause some problems for example Visual Studio can’t load the project well.
    If no helps, I think maybe there are something wrong with your operating system.
    I hope this will be helpful to you.

    Best regards,
    Amanda

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked As Answer by dkcorp Friday, August 10, 2012 12:20 PM
    •  
  • Friday, August 10, 2012 12:20 PM
     
     
    Thanks a lot Amanda, I had Visual Studio 2010 and 2012. Problem solved.

    Dilshod

  • Wednesday, September 05, 2012 12:59 PM
     
     

    Hi dkcorp,

    What you did to resolve this issue? I'm also facing the same issue(it says test in pending all the time, I had to restart my VS to stop it). Even I  have multiple visual studios(VS2008, VS2010 and VS2012) installed on my machine. 

    Thanks,

    Sunil


    Sunil

  • Wednesday, September 05, 2012 7:15 PM
     
     Answered

    Hi Sunil Kumar Reddy,

    I had Visual Studio 2010 Ultimate and Visual Studio 2012 Ultimate. I deleted Visual Studio 2012 and it was working fine. Problem was to have multiple "Visual Studio"s on my machine.

    I hope this helps.


    Dilshod

    • Proposed As Answer by Sunil Kumar Reddy Thursday, September 06, 2012 9:06 AM
    • Marked As Answer by dkcorp Thursday, September 06, 2012 1:52 PM
    •  
  • Thursday, September 06, 2012 9:08 AM
     
     Proposed Answer

    I have vs2008, vs2010 and vs2012RC on my machine. I uninstalled VS2012RC and it started working. Thanks..


    Sunil

    • Proposed As Answer by J2DN Wednesday, September 19, 2012 12:11 PM
    •  
  • Wednesday, September 19, 2012 12:14 PM
     
     

    After spending a whole day trying out various solutions, this is the one....

    Just keep one version of VS on your machine if your Unit Tests are getting stuck in the Pending state.

    Problem Solved!

    Thanks,

    J2DN 



    • Edited by J2DN Wednesday, September 19, 2012 12:15 PM
    • Edited by J2DN Wednesday, September 19, 2012 12:15 PM
    •  
  • Monday, September 24, 2012 11:42 AM
     
     
    Woah woah wait a second - everybody simply accepts that as the answer? What if you actually need Visual Studio 2012? You have to have two installation of Windows just to be able to run two versions of Visual Studio? The sh*t we put up with... I'm speechless.
  • Monday, September 24, 2012 4:55 PM
     
     

    Hi FrodeNilsen2,
    I think it was two month ago, I had Visual Studio 2010 Pro and Visual Studio 2012 RC Ultimate. I couldn't run my tests because I had two different kind of Visual Studio installed. Now I have Visual Studio 2010 Premium and Visual Studio 2012 Premium. I can run my tests easily.

    Thanks,


    Dilshod

  • Tuesday, September 25, 2012 12:23 PM
     
     
    Ok dkcorp, but I had the problem myself. I run VS 2010 Ultimate and VS 2012 RC Express. My solution was to install NCrunch, an alternate MSTest test runner. It works, but it shouldn't be necessary to rely on a third party, in my opinion.
  • Tuesday, September 25, 2012 1:39 PM
     
     

    Hi FrodeNilsen2,

    I apologize if I didn't understand you correctly, I didn't have any problems running nUnit tests on that time. I had problem with MSTest test runner.


    Dilshod