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