Unit Testing Tools in Visual Studio 2017

Sign in to queue

The Discussion

  • User profile image
    daveparvin

    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.

  • User profile image
    kendrahavens

    @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!

  • User profile image
    daveparvin

    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.

  • User profile image
    kendrahavens

    @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!

  • User profile image
    tgrt

    @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.

  • User profile image
    pajocomo

    @KendraHavens, is intellitest available for SDK projects?

  • User profile image
    kendrahavens

    @pajocomo: Unfortunately no, it's only for .NET Framework projects right now. Adding .NET Core support is a top ask we will look at in Visual Studio 2019.

     

    @tgrt: Thank you for sharing! It's very helpful to validate. We definitely want to create the best experience.

     

  • User profile image
    LarsH

    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?

  • User profile image
    LarsH

    Intellitest for VB.Net would be great !

  • User profile image
    kendrahavens

    @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.

  • User profile image
    LarsH

    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 !?

  • User profile image
    pajocomo

    @kendrahavens: I'm not talking about targets but project systems. I use SDK projects for .NET Framework.

  • User profile image
    kendrahavens

    @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.

  • User profile image
    pajocomo

    @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?

  • User profile image
    Fahad Ahmed

    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 ?

  • User profile image
    Bleak Morn

    @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?

  • User profile image
    kendrahavens

    @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.)

  • User profile image
    Bleak Morn

    @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!



    I was mostly curious about any new features that had been added to VS since the video was produced.  If there are no major new testing features in VS then this should be fine! Thanks!

  • User profile image
    kendrahavens

    @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

     

  • User profile image
    Verdi

    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

  • User profile image
    Prince

    Very useful and nice session. The Intellitest option is not enabled for Azure Function App Project. Is Intellitest available for Azure Function App Projects.

  • User profile image
    kendrahavens

    @Verdi: I don't believe we offer something like that. To clarify, are you suggesting an Intellitest feature for keeping track of all generated tests?

     

    @Prince: Thanks for watching and for the feedback! I don't believe we've catalogued this request on uservoice. Would you mind opening a suggestion? 

  • User profile image
    dvded

    @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.

  • User profile image
    Thomas Brown

    Thanks. Great presentation.

  • User profile image
    kendrahavens

    @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.

     

  • User profile image
    Jeremy Blosser

    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.

  • User profile image
    OzBobWa

    Hot Tips has a new pull request for 'Create Unit Tests'.

    https://github.com/justcla/HotTips/pull/53

    Thanks for suggesting it @kendrahavens

  • User profile image
    akainu432

    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! 

  • User profile image
    kendrahavens

    @OzBobWa: Thanks OzBobWa! This is great!

     

    @akainu432: Thank you and let me know if I can help! You may have already found them, but our docs for Intellitest can be found here.

  • User profile image
    akainu432

    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! 

  • User profile image
    akainu432

    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

  • User profile image
    rogreen

    @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. :)

  • User profile image
    kendrahavens

    @akainu432:Ah, I'm glad you are unblocked!

    @rogreen: I can't wait either! :)

Add Your 2 Cents