2

I am trying out the new Visual Studio 2015 CTP 6 and the first thing I notice was that for new ASP.NET 5 project there isn't an option to create a Test project (it's disable)... Now, VS2015 introduced Smart Unit Tests but it is not suitable for TDD, the idea is to generate unit tests for already existing code.

Probably exists a nuget-package to implement TDD but what I find weird, I believe, it's not longer come out of the box.

So, how implement TDD in the new Visual Studio 2015 CTP6?

enter image description here

Update 3/22/2015

Here some links related to this unresolved issue:

Community
  • 1
  • 1
Jaider
  • 14,268
  • 5
  • 75
  • 82

1 Answers1

1

Great question. Here is what I settled on. I wouldn't call it ideal and maybe there is a better way that I am not aware of.

1) Use xUnit - if you look at the aspnet repository on github, you will see most if not all the tests written with xUnit.

2) Visual Studio IDE support for xUnit is not yet available for ASPNET5 based tests. You must run them from the command prompt. This link discusses how to set up and run unit tests for ASPNET5 http://xunit.github.io/docs/getting-started-aspnet.html

3) Complicating matters, the just released version of xUnit does not support ASPNET5, but RC3 does and it is still available on Nuget. Per this tweet https://twitter.com/xunit/status/574692021123731456 ASPNET5 support will return in xUnit 2.1, a version of which should be released soon.

4) Even after following all the instructions, I had a problem that I believe was related to storing my project on a UNC path instead of a path with a drive letter, so don't let that bite you. https://github.com/xunit/xunit/issues/295

NPNelson
  • 2,940
  • 2
  • 16
  • 27
  • **Update 3/26/2015** I have confirmed that I can now run ASPNET5 xunit tests in the VS Test Explorer (phew!). Make sure you read the _Update 3/22/2015_ in the original question and it will show you how to do it. I had to restart all my VS2015 instances to get it to work. – NPNelson Mar 26 '15 at 20:59
  • Thank you for your answer @NPNelson. This really helps me. I made it worked adding this 3 packages: `xunit`, `xunit.runner.aspnet`, `xunit.runner.visualstudio`. The .aspnet package was tricky, I added with the UI nuget interfaces (found easily), instead of text-command (it didn't find it). – Jaider Apr 04 '15 at 05:15
  • remember to use aspnet 5 class library and not unit test project type for your tests, check global.json that have the "test" folder included and place your 'test (class) project' inside the "test" folder and not in the "src" folder. – Bart Calixto Apr 09 '15 at 14:43