CodeMaid

In this video, Robert is joined by Kendra Havens, who shows us some of the excellent unit test tooling in Visual Studio 2017, including testing performance improvements [03:57], Hierarchy View in the Test Explorer [05:13], generating unit tests [09:35], Intellitest [10:50], code coverage [16:10] and Live Unit Testing [19:10].
Even though you say that Intellitest and generating unit tests are for .NET projects, they only work in C# .NET projects, not in VB.NET projects. I do enjoy using Live Unit Testing with both C# and VB though.
@daveparvin:Sorry for not mentioning that! Yes, intellitest is only for C#. I'll make that clearer in my slides. I'm glad you are liking Live Unit Testing!
There are a lot of features in VS that only show up for C#. I also know there are features that only show up for VB. I notice that sometimes I see problems because some new feature is written assuming they both work the same way and they don't.
@daveparvin: If you'd like to email me about what pains you are running into and your scenario I'd be happy to learn and share them with Kathleen Dollard. My email is kehavens @ microsoft. com (without the spaces.) I know a lot of asks are catalogued on developer community or user voice to improve VB support, but sometimes it helps to share the whole picture of what is getting in the way of your day-to-day development. Please reach out if you are interested!
@KendraHavens You're right to be concerned about users wanting their tests organized in such a way. It'd be a big deal to me. I've had a prejudice against code generation for as long as I can remember, so it needs to be adaptive and not get in the way.
I always love your presentations.
@KendraHavens, is intellitest available for SDK projects?
Thanks for a very good and important show !
Why do I have to go to Nuget to get the latest version of MSTest.TestAdapter ?
I thought that we got all this good stuff when we update Visual Studio.
(If I install for solution I have to go and look for new updates for MSTest.TestAdapter for every solution ...)
Do You know what version I have when using just the latest Visual Studio ? Is there a way for me to look it up?
Intellitest for VB.Net would be great !
@LarsH: We won't auto-update the nuget references in someone's project to the latest when they update Visual Studio. You can imagine, that could cause issues for people who may not always be able to update to the latest because they rely functionality that may have changed in recent versions.
You can look up the current version of your MSTest.TestAdapter in a few places: in your csproj, the Nuget Package Manager for Solution, or you can double-click on your reference under the "References" node in the Solution Explorer which opens it in the Object Browser.
I saw that the Nuget-packet have Dependencies on for example .NetCoreApp,Version=v1.0.
So if I want to install I have to install these dependencies.
(I want to have the famous version 3 Before I start with .NetCore)
But still - I do have the functionality of MSTest.TestAdapter in the regular Visual Studio.
What is it then that I have in Visual Studio at the moment ?
Whatever it is called it is fast enough for my testprojects (about 1000 tests).
But is there some other functionality I am missing ?
Is there something that would compell me to install the Nuget-packet ?
The Description is:
"The adapter to discover and execute MSTest Framework based tests. "
But as said above I already have this functionality !?
@kendrahavens: I'm not talking about targets but project systems. I use SDK projects for .NET Framework.
@pajocomo: Sorry, I see what you mean. No, currently it is only available for .NET Framework projects that have the old csproj format. I'll try to follow up as to why.
@pajocomo: Sorry, I see what you mean. No, currently it is only available for .NET Framework projects that have the old csproj format. I'll try to follow up as to why.
Is there an HowTo if I want to do it by hand?
Cool, as far as the discovery and test stubs generation is concerned. I have VS 2017 community edition and had the chance of writing some small unit tests using NUnit. To my surprise, it's not possible to run nunit tests, that is what I received as a reply on the VS forum.
Any chances that NUnit could join the A Team ?
@kendra you mentioned some Microsoft Virtual Academy (MVA) resources for Testing Legacy Code and Test Driven Development.
I saw this ( https://mva.microsoft.com/en-US/training-courses/testdriven-development-16458 ), which touches on Testing Legacy Code a bit in part 6.
Is this the specific content you were talking about or is there more (and more recent) content on this topic in MVA?
@pajocomo: Unfortunately, no not at this time.
@Fahad Ahmed: I believe you will need this extension to generate NUnit tests:https://marketplace.visualstudio.com/items?itemName=NUnitDevelopers.TestGeneratorNUnitextension-18371
@Bleak Morn: Yes, that's the one! Though, your link was broken for me. The whole series really gets you on the right track for TDD. If you want further reading they mention a few books that go more in depth. As to asking if there is more recent content, in my own opinion, I appreciate content that captures the basics and gives good advice while avoiding the many industry fads in this area. Is there some crucial content you feel is missing? I'd love to hear it!
@LarsH: You can check your Nuget Package Manager in Visual Studio to see what you have installed. The MStest.TestAdapter and MSTest v2 nuget packages have the latest performance improvements and I recommend using them. You might still have the old MSTest adapter extension installed instead of nuget packages. I'd also recommend using the nuget packages instead of the older extension for better performance. (We recommend moving off the older .NET test adapter extensions if you are still using them due to performance gains you can get with using the nuget package test adapters instead. Read more.)
@Bleak Morn: Yes, that's the one! Though, your link was broken for me.
I fixed the link. The closing parenthesis was too close to the end of the URL. I fixed it in my post.
As to asking if there is more recent content, in my own opinion, I appreciate content that captures the basics and gives good advice while avoiding the many industry fads in this area. Is there some crucial content you feel is missing? I'd love to hear it!
@Bleak Morn: Gotcha, there are a ton of major new testing features added to VS since those videos, but not specifically for tactics on testing legacy code. Major improvements: better performance in test discovery and execution, new Live Unit Testing features, updated Test Explorer view with the hierarchy, responsive test runs, and C++ built-in support for Google test and Boost.Test to name a few :D
A very fruitful session, Thanks!
I will encourage my dev team to start doing unit test using intellitesting.
Is there any report that I can extract let say for 1st cycle ,2nd cycle, 3rd.. So I can roughly measure the team efficiency in coding
Very useful and nice session. The Intellitest option is not enabled for Azure Function App Project. Is Intellitest available for Azure Function App Projects.
@kendra The one really annoying thing when I use Live Unit Testing, is that to make Debug Tests work on the same test, you need to stop Live Unit Testing (which is not possible to Resume most of the time, so need to restart VS). While I could live without Debug, in a stack trace of Live Unit Test failure there are no even line numbers.
Thanks. Great presentation.
@dvded: You should be able to debug any selected tests through either the Live Unit Testing glyphs, the right-click menu, or through the Test Explorer without needing to stop Live Unit Testing at all. You certainly should not need to restart Visual Studio. Would you mind filing a bug on developer community? A repro solution or steps would be very helpful!
The StackTrace that appears when hovering over the Live Unit Testing glyph doesn't list line numbers, but if you wanted to investigate a test, you can view the results in the test explorer where the StackTrace is actually an active link to the line of code it lists. If you wanted to know the line number without navigating there you can hover over the link.
Really good presentation but is disappointing that the most useful features are Visual Studio Enterprise only. Especially for those of us who used PEX back when it was a research product.
Hot Tips has a new pull request for 'Create Unit Tests'.
https://github.com/justcla/HotTips/pull/53
Thanks for suggesting it @kendrahavens
Hey there Kendra congratulations on the presentation. I was trying Intellistest with a Windows Forms Project and i'm running into all sorts of errors, i mean it creates the Tests and runs them but i never get any useful result like your presentation where everything runs smoothly, guess i gotta dig in the forums, still keep up with the good work!
Hi again kendra i just watched another presentation with Jeff Fattic and i got a better understanding of how the pex engine works and how to make sense out of the warnings. Well i'm having a problem saving the tests i mean the "floppy icon" is always grey. I'm not sure if this is the right place to ask for help on a specific topic but any help would be appreciated. Thank you again for your time!
Well i truly am a newcomer turns out i had to create a Unit Test Project to hold the tests…..Thanks a lot a keep up with the good work! Looking foward to the summer series!!! :D
@akainu432: The summer series (4 episodes on Unit Testing with Phil Japikse) debuts in about a month, so I guess that makes it the Fall series. :)