问题
In the new Visual Studio 2013 there is a nice new feature called Code Lens (I think that it is only in the Ultimate version). Regarding methods, besides it shows references (how many and where) it also shows some information about versioning when working in team and tests statistics so that you know how many tests using the method are passing and how many failing.
I assume that this works perfectly with test projects embedded in Visual Studio, but does it work with NUnit? We are using NUnit for unit testing and we are trying to decide whether or not to move to VS2013 and one of reasons would be this new feature that we would sure like to use to its full extent if it support NUnit.
Do you have any experience with it?
回答1:
The tested by and test status indicators are powered by the test explorer.
So if your NUnit tests show up in the test explorer, they should also show up in CodeLens.
回答2:
I don't have enough reputation points to add as a comment to John Gardner's reply, so I adding a new answer.
I added an answer to a similar question here - CodeLens only finds tests that are written in MSTests
Summary of that answer - you need to create a new Unit Test Project and add a reference to NUnit to that new Unit Test Project. That is how I got it to work with VS2013 and NUnit (along with the NUnit Test Provider) so now the tests show up in VS2013 Test Explorer window and in CodeLens.
来源:https://stackoverflow.com/questions/19725751/visual-studio-2013-feature-code-lens-with-nunit