Search code examples
c#visual-studiounit-testing.net-coretest-explorer

Visual Studio: Test Explorer Copying Title names of Unit Tests into Flat File CSV or Excel


We are creating a Unit test project for our C# Net core project. How do I copy the names of all tests, and if they passed succeeded/or failed into an CSV or flat file excel spreadsheet from Test Explorer. When I do right click and copy, it pastes it into a not good looking format. Again, just looking for tests names and results from Visual Studio 2017.

enter image description here

Export test results from Test Explorer visual studio 2013


Solution

  • Since you are not mentioning automated way or using codes, you can use group summary window and it will give result nice way, test name and status. Use Copy all button.

    enter image description here

    Results will be like this enter image description here

    Or you can generate trx file, which contains test results. It is a xml file and you can read that generate your excel file.

    Go to this folder

    C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow
    

    And Run below command.

    vstest.console.exe yourFullProjectPath\YourTestProject\bin\Debug\netcoreapp2.1\YourTest.dll /logger:trx;LogFileName=C:\Users\Codes\testresult.trx