Grouping and Filtering in mstest unit testing in visual studio

Easy grouping in mstest unit testing in visual studio.

In a big project, there is a lot of methods and classes so that it is difficult to manage unit test cases.In this article, we are learning How to create grouping in mstest unit testing in visual studio and manage it. 

There are different ways to grouping test cases in mstest visual studio
  • Class
  • Duration
  • Outcomes
  • Traits
  • Project
  1. Class wise grouping in mstest

    Grouping the test cases are divided into two ways. Now we can see it practically.
    After running the test class it divides into three cases like Test Passed, Test Failed, Test Not Run.
    By Default unit testing grouping is Outcome.
     

     As per the showing above image click on test explore then you will be getting grouping category

    click Test

    Another way selecting grouping is to right-click on any test case-> select group by function->select any category.
     If You select grouping by class then test cases output showing as per class. The output Showing like this.

    Class Test


    2. Duration wise grouping in mstest

    After selecting the Duration category it sorted tests like taking less time, medium time, and then
    taking more time. You getting more idea after seen below image.
    Duration

     

    3.Project wise grouping in mstest

     When you working on two different test projects. That time it little confusing which test case working in different test cases. Especially two projects have the same naming convention.
    Then you can test cases can be grouping by the project

    ProjectTesting
    In the above example, there are two projects DivideTest and Sub which have different methods.
    You can be grouping the test cases using traits. In traits having different conditions.


     Filtering in mstest unit testing in visual studio

      At any time you want to be searching test cases, then use filtering in Test Explore. Filtering test cases in multiple ways.
    • Class
    • Project
    • Traits
    • Error Message
    • File Path
    • Fully qualified name
    • Output
    • Outcome

     

    Filtering Cases

    This is how to Grouping and Filtering in mstest unit testing in visual studio

     

     

 

Previous
Next Post »