How to copy and share the execution details of Unit Test methods from the Test Explorer in Visual Studio ?

How to copy and share the execution details of Unit Test methods from the Test Explorer in Visual Studio ?

Visual Studio Test Explorer  gives us a quick access to the test methods and execute them efficiently as and when they are required. We have seen how we can Explore and Manager Unit Tests Using Test Explorer in Visual Studio .  Text Explorer listed the test methods, with passed / Failed Status along with time taken for each execution.  The bottom part of Text Explorer shows the details of the unit test method, like method name, time take, stack trace etc. Sometimes it may require to share particular  test result, execution time,  stack traces in case of failed etc. with other developers in team. Generally we execute them from our own dev box to see the result. However,  Test Explorer provides us a very small nice feature to get the information into the clip board.

This is how a Test Explorer looks, where it has list of unit test with the details of results

image

Once you select the failed test method, the details section would display the similar information like a passed test, with some more details like stack trace .

image

Now think about a scenario, where you want to share the failed test method details to another developer in your team.

You can select either the details, or individual method to get the details of execution. Right Click on Test Method or Details Result. Then from the Context Menu, Select “Copy” / “Copy All

image image

This actually does a really cool stuff. It copies all the test execution details and copy it to clip board.   This contain following information

  • Test Name
  • Test Full Name
  • Test Source
  • Test Outcome
  • Test Duration
  • Result Stack Trace
  • Result Message

Here is how it looks like.

image

Test Name:    AddTwoPostiveNumberTest
Test FullName:    MyTestClass.Tests.CustomLogicTests.AddTwoPostiveNumberTest
Test Source:    C:\Users\testuser\Documents\Visual Studio 2015\Projects\TestConsoleApp\MyTestClassTests1\CustomLogicTests.cs : line 16
Test Outcome:    Failed
Test Duration:    0:00:00.0529468
Result StackTrace:    at MyTestClass.Tests.CustomLogicTests.AddTwoPostiveNumberTest() in C:\Users\testuser\Documents\Visual Studio 2015\Projects\TestConsoleApp\MyTestClassTests1\CustomLogicTests.cs:line 19
Result Message:    Assert.IsTrue failed.

This is really nice and cool feature. This will enable developer share the information of test results among developer.

Hope this helps.

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

2 Comments to “How to copy and share the execution details of Unit Test methods from the Test Explorer in Visual Studio ?”

Comments are closed.