How to get user output on vstest console?

I have some data-based tests written in Visual Studio 2012. When I run the tests from the console by running the following command at the Visual Studio 2012 command line vstest.console.exe myTestSuite.dll , I get the following message:

Launching a test run, please wait ... Passed myTest (data line 0) Passed myTest (data line 1)

...

etc.

...

Total tests: 10. Missed: 10. Error: 0. Missed: 0.

Test completed successfully.

Test execution time: 53.4545 seconds

How to change this result from my tests? I would like to print something like this:


Running MyFirstDataDrivenTest

Passed MyFirstDataDrivenTest

Lead time: 2.1111 seconds


Launch MySecondDataDrivenTest

Error MySecondDataDrivenTest.
Login failed. Check the input. Lead time: 4.2222 seconds


...

etc.

...


Total tests: 10

Submitted: 9

Failed: 1

Missed: 0

Failed to run a test run.

Test execution time: 53.4545 seconds

I tried testContextInstance.WriteLine (), Console.WriteLine (), Debug.WriteLine (), Trace.WriteLine (). Nothing works. testContextInstance.WriteLine () writes to the console only if the test fails.

I managed to achieve similar functionality in Visual Studio 2010 by running the following command:

MSTest / testcontainer: "myTestSuite.dll" / detail: stdout

But this is not supported in Visual Studio 2012.

Please, help. Thanks in advance.

+4
source share

Source: https://habr.com/ru/post/1493315/


All Articles