VS2010 Run unit test (error)

When I click on unit test and execute "Run Test" from the context menu. The test result will not start a good test as it will not see my new test and resume my last test over and over again. What's wrong with my config.

Is anyone experiencing the same problem?

+3


source to share


3 answers


I am experiencing a similar error with my regular projects. Let's say I have a file open in VS text editor and that file belongs to project A, which is a dll. Then right click on project B which is exe and choose Debug-> Start New instance. Sometimes (not always) VS tries to start project A, so I get the error "Unable to start project with release type of class library".



When this happens, I open the file from project B and save it as active when I run project B. This works around the problem. So, try opening the file from the test you want to run and keeping it active while you run it from the context menu. I am guessing that this error also affects test execution. I was thinking about submitting a bug report, but I was lazy ...

0


source


Visual Studio is often very volatile about new tests. There is a configuration setting (Tools -> Options) that determines whether the IDE will receive new tests as it is written, however this is a bit of a performance hog so the setting is disabled by default.

Visual Studio relies on a VSDMI file to represent test metadata in a solution. This file is usually updated when the solution is compiled, although there are times when the analysis of the solution fails or it cannot find new tests. If this file is out of sync, or the test you are trying to run is not already in VSDMI, the Run Tests in Current Context feature does not work as expected. Sometimes it runs neaby test, sometimes it runs all tests.



To allow or activate the discovery of new tests, or open the Test List Editor view and click the refresh icon in the toolbar. The refresh icon forces you to quickly recompile and update vsdmi.

0


source


I found that the context menu options for running tests rarely behave as expected when you add a new test. However, keyboard shortcuts work much better. Control-R, T runs tests in the current context. If your cursor is in a test method, it runs that method. If it is in a test class, it runs all tests in the class. If it is outside of the class, I believe it runs all tests in the assembly (or perhaps in the namespace). There are a few more shortcuts here . Note that Control-R, Control-T runs the test test (current) in the debugger, which is also useful.

0


source







All Articles