6

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?

Ondrej Janacek
  • 12,486
  • 14
  • 59
  • 93
  • I'm assuming that it's up to the test adapter extension to provide that information. It works great with XUnit. – Jimmy Nov 01 '13 at 16:03

2 Answers2

6

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.

John Gardner
  • 24,225
  • 5
  • 58
  • 76
  • Do you have any source that would confirm your statement? – Ondrej Janacek Nov 02 '13 at 07:22
  • 1
    @OndrejJanacek He is one of the engineers who built Code Lens. – 123 456 789 0 Nov 04 '13 at 17:58
  • @LeoLorenzoLuis Hah, you are right. I guess that his answer is correct then :) – Ondrej Janacek Nov 04 '13 at 18:09
  • Yup, I didn't work on the test provider *specifically*, but I know how it works. :) – John Gardner Nov 05 '13 at 20:21
  • @JohnGardner What if they are showing up in the test explorer and not in CodeLens? I'm using VS 2015 Preview. Could that be the reason? – Anshul Dec 18 '14 at 21:39
  • 1
    @Anshul Yes. For me, i'm not seeing tests of any kind (even mstest!) showing up in the indicators in the 2015 preview. – John Gardner Jan 03 '15 at 04:01
  • John is correct that it is powered by the test explorer. I noticed the CodeLens icons and notifications didn't show until I ran my tests through the Test Explorer. I was running them through the NUnit Test Adapter previously and they didn't show up. Thanks for the help. – MadDogMcFie Sep 30 '15 at 13:01
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.

Community
  • 1
  • 1
Jim
  • 31
  • 2