Unit Test Wizard doesn't let me select certain projects.
When adding a new unit test to my test project, the Unit Test Wizard jumps back to the "Add New Test" dialog when I select certain projects. If I try to click either the '+' sign for the tree structure of the project or try to click on the project's CheckBox, the dialog returns to "Add New Test". Is this because test units cannot be auto-generated for this project, and if so why do I not see some form of message dialog?
--Edit--
I also attempted to create a test unit directly from the class that is to be tested. I received the error: "The source code cannot be sufficiently parsed for Code Generation. Please try to compile your project and fix any issues." My project compiles fine and I don't see any errors when running. I'm assuming this is my problem with the unit test wizard, so I will try to implement the test units manually if there is no way around this parsing problem.
-nate
Answers
naxtell wrote: The project is a Class Library and not the startup project. The option is disabled and has no startup object to select. OK. Bring up the project settings. Select the 'Resources' tab. It most likely will tell you that you have no resource file associated with the project - and do you want to create one.
Go ahead and create one. Having it be empty is just fine - We also seem to have an assumption that this always exists in VB projects - which is the case in a VSTS created VB project.
Joe
All Replies
- I'm getting the same issue. Searhing the web and this forum leads me to believe that we're the only one's getting this issue. Have you had any success in getting this to go away?
Hi guys.
First, I would like to know if VB or C++ are involved, or if this is all C#.
These errors are caused because the object model layered over the source code is having problems parsing. Obviously, this should only happen when the program is not syntactically correct - and this is not what you are seeing.
I would like to know also if you are failing just expanding a node in the 'selection' dialog, or when the code is actually being generated. If it is when selecting what to generate tests for, are any of the nodes expandable in the problematic projects, or will any expansion trigger the failure.
Finally, if your repro of this problem is on source code you can send out, it would be great if I could work on the problematic sln. If that's possible, let me know and we'll coordinate it.
Joe
I am working with VB.
This problem occurs when I try to expand certain projects, not all of the projects. The projects that this occurs for are ones that also fail to parse when I try to auto generate a test class from right-clicking on the class name in the class's code view.
I will try to come up with a sample of the occurrance.--Edit--
It seems that all of the classes in a certain project prevent unit test creation. My projects were converted over from VS 2003. Could there be a configuration problem with the project?
-nateLet me try converting some 2003 projects and see if that's sufficient to repro. If this turns out to be the issue, hopefully I will be able to get you a work around.
Thanks!
Joe
Hey Guys.
I have something I'd like you to look into.
Right Click on your project, bring up 'Properties'. On the 'Application' tab, see if 'Enable application framework' is turned off.
If it is, please turn it on. See if this does not resolve the problem and let me know.
If my repro is sufficient, it looks like these options are always on in a new application, and almost always 'off' in a converted project - and we do not deal with it well in the current version.
Please let me know if this works around the problem for you!
Joe
- The project is a Class Library and not the startup project. The option is disabled and has no startup object to select.
OK. The root of the problem is the way we enumerate code elements for VB projects and rely on project settings.
I'll have to see if I can find something that fixes class libraries as well. Sorry for the delay.
naxtell wrote: The project is a Class Library and not the startup project. The option is disabled and has no startup object to select. OK. Bring up the project settings. Select the 'Resources' tab. It most likely will tell you that you have no resource file associated with the project - and do you want to create one.
Go ahead and create one. Having it be empty is just fine - We also seem to have an assumption that this always exists in VB projects - which is the case in a VSTS created VB project.
Joe
- That's it, thanks.
-nate HI
I get this eact same problem in C#,but this solution does not seem to oslve it. Can you pelase help?
Thanks
The problem I found was localized to testing a VB project.
Can you give me any more info?
Was this project ported? Is there any code outside of all namespaces?
The latter should not be a problem, but I'm trying to guess where the problem may be starting.
If you have a small repro to share, that would be great.
Joe
- I am having this very same problem with a C# web site. We have 15 additional C# class libraries and 1 VB class library included in the solution, but I am only having this problem come up in the web site. Any ideas?
I would like to confirm. You have the problem with a C# Web Site project.
If you make an empty solution and add just the 'existing' C# Web Site project to the solution, do you still have the problem?
Is this a VS2005 created Web Site, or an upgrade of a web site project from a previous version?
Is this a file-system Web Site project, or an IIS URL? If it is an IIS URL, is it localhost, or on a remote host?
Sorry for so many questions, but there are so many configurations for web site projects, it can be hard to nail down what's happening.
Joe
First of all, thank you for your reply! I was afraid this thread had been inactive for too long. As for the questions, don't worry about it. I should have been more specific but figured you might've received enough questions about this issue by now to be able to answer in general terms.
I am running this on a VS2005-created web site, on my localhost IIS. The entire solution is stored in SourceSafe2005 and is being shared among 8 developers who do not have the same problem I am having. They can generate unit tests without any problem.
Additionally, if I create a new solution and test project and include the website in the solution, I still get the same problem occurring.
Today I migrated the website to a Web Application Project successfully (and quite seamlessly, I might add... great job Microsoft!), but I am still getting the same error.
One last piece of information that might be important is that unit test generation was, at one point, working without problems. But since there are 8 developers working on this it's kind of hard to pinpoint exactly when this began happening.
Thank you for your help.
OK. This isn't going to get fun any time soon. :)
What do you see? The name of the project with a broken plus sign in front of it? Or an expanding pluss sign that expands to nothing, or no project at all?
If you zip up a stand alone version that does not work from your machine and take it to a coworkers machine and unzip it, does it work on their machine?
Can you cancel out of the test generation tree control dialog, or does it hang?
And finally - if you just use the new project wizard to make a new website, does it get populated correctly?
What I'm really hoping is that if you find you can zip it and unzip it on another machine and reproduce the problem, that maybe there is a way for you to e-mail me a stripped down broken project/solution.
Joe
Awh geez, the issue is more complicated than I thought...
If I open the unit test generation Wizard, I originally see a tree with all the projects, including the web project. When I click on the plus sign to expand the tree to choose which classes to generate, it throws up the error messagebox. Once I click OK, the entire test generation window closes.
If I right click on a class or method in the web app project and select "Create Unit Test..." from the context menu I simply get the error messagebox and then nothing else once I click OK.
I can cancel out of the unit test generation dialog window as long as I never try to expand the web project tree, because if I do then I will simply get the error messagebox and then the whole dialog will close itself once I click OK.
As for putting the project on another machine and checking to see if I can generate unit tests, I put the solution on my personal laptop and I can generate unit tests just fine. No error whatsoever. Keep in mind that myself and all of the developers on this team are working from the same fiiles in source control, and nobody seems to get this error but me.
If you want me to send you a stripped down version, I certainly can, but since all devs here are working from the same files, I don't know if that would be the issue.
This is driving me nuts.
Thanks. The reason I asked about zipping it up is because there are 'isntance files' for VS projects that do not go into source control (the suo files, ncb files for c++, etc...). And I wanted to discount something corrupt in these files as a candidate.
I'm going to have to ask an even more disturbing question now.
Is this machine dual core, multi-cpu, or hyperthreaded? If so, could you consider going into the BIOS and disabling a core or hyperthreading - something to take it down to 1 CPU. Early in the product cycle we saw some issues with the source code parser's multithreading when more than 1 real/virtual CPU was present.
I didn't bring this up before because we haven't seen this issue arise in the shipped product, and I thought we got it taken care of.
I don't suppose you live in Washington State where I could come debug it. :)
Joe
Thank you for your attention in this matter. My computer is not multi-cpu and doesnt use hyperthreading. It might have something to do with one of the files not stored in source safe.
Based on your feedback, I think I'll try to remove the project from my machine and re-add from source safe. Hopefully that should solve the issue. I will do this tonight from home and then post the results.
Thanks for your help!
I deleted the project from my machine and re-loaded it from SourceSafe, but THE SAME !$@% THING KEEPS HAPPENING!!! What is going on?!?!?
I don't even care anymore...



