Locked Cannot create unit tests. assembly needed?

  • Friday, August 01, 2008 2:40 PM
     
     

    I'm currently using visual studio 2008, and I'm trying to create a unit test for my class. I right-click on a function and click "create unit tests." A window pops up with a blank list of types. there are 2 buttons at the bottom, one saying "settings" and one saying "add assembly." If i click "settings" the window closes and nothing happens. If I click "add assembly" it forces me to add an assembly. I click "OK" after adding an assembly and window closes and nothing happens again. I have all the assemblies I need already in my project. In my last project I right-clicked a function, clicked create unit tests. in the tree i checked all the files I want to test and it generated a template of a test and I filled in the blanks. What am I doing wrong for this project?

All Replies

  • Friday, August 01, 2008 11:22 PM
     
     

    This usually happens when the class you are trying to generate tests for does not compile.

     

    Can you check if it does?

     

    -Euan

     

  • Tuesday, August 05, 2008 8:33 PM
     
     

    The test compiles. I get a window that should have a tree of my current project. Then I should be able to check the file I want to generate tests for but I don't get the tree. It worked for my last project.

  • Monday, September 01, 2008 11:26 PM
     
     

     

    There may be some classes/interfaces in the project that makes our generation not work.  Can you attach your project or send it somehow.

     

    Thanks

     

  • Thursday, September 04, 2008 11:10 PM
     
     

     

    Hi Scott,

     

    You can send me the project you have to my email.  Just remove online.

  • Wednesday, September 10, 2008 8:09 AM
     
     
    I am experiencing the same.
    I can reproduce this always by doing the following:

    1. Create a sample project, i.e. a class library in C# and name it myLib
    2. Create a SubFolder wihtin the myLib project folder named "UnitTests"
    3. Right-click in the solution and add new C# test project. Place it in the UnitTests folder name it myLibUnitTest


    Now, if you go to Class1 in myLib project and write a function, i.e:

    public bool MakeMeSmile( )
    {
       return true;
    }


    right-click on this to reproduce the problem.

    Creating the unit test project in the way described above is so far the only way we've found to create unit test projects in a folder of our own choosing. Because we have different folder placements depending on project sizes, it is always important that we have full control over where, physically, the projects are created.


    Edit:
    Additional information:
    I am attempting this under Visual Studio 2008, with Service Pack 1 installed.
  • Thursday, February 19, 2009 9:14 PM
     
     
    I'm experiencing the same issue. I'm using ASP.Net MVC RC and Visual Studio 2008. All the classes do compile.