简体   繁体   中英

Formatting console output when running multiple Unit Tests in vstest.console.exe



Situation
I'm using vstest.console.exe to run some unit test projects at once. Also I am interested in the console output since I cannot use I/O operations to log results to .trx file. I am also limited to one instance of vstest.console.exe. So I want to run UnitTests1.dll, UnitTests2.dll etc. all at once. I'm achieving this in following way vstest.console.exe UnitTests1.dll UnitTests2.dll . This works just fine as tests get executed and I get my console output.

Problem
The problem I run into is the formatting of the output. It looks something like this default output from the console . The issue is that all the unit test projects are bundled together as if I'm running a single unit tests project.

Goal
I want to have the output from each Unit Test project on its own separate line as it were, something like this UnitTests1: Total tests: 3. Passed: 2. Failed: 1. Skipped 0. UnitTests2: Total tests: 3. Passed: 3. Failed: 0. Skipped 0.

In other words, is it even possible to format* console output in vstest.console.exe? Thanks in advance!

By default vstest.console.exe doesn't support formatting, but it has logger option, where You can specify what You want to do with output. There is created logger on GitHub .

You can force the vstest.console.exe to make an xml formatted file with result, then parse the results with Your app (as You require) -> basically create wrapper around.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM