vstest icon indicating copy to clipboard operation
vstest copied to clipboard

Vstest.console.exe runs as if the test name is a partial pattern rather than a full name.

Open primalspacesystems opened this issue 7 years ago • 4 comments

Description

Vstest.console.exe runs as if the test name is a partial pattern rather than a full name. e.g. "vstest.console.exe UnitTests.dll /Tests:Beta /Platform:x64 /InIsolation" runs any test with 'Beta' in the name

Steps to reproduce

Make two tests with one being named as the substring of another. Use vstest.console.exe to run the test with the shorter name. Both tests will run when only one should.

Expected behavior

Only the specifically named test should run. Specifying wildcards would work e.g. "/Tests:Beta*" would run every test starting with "Beta"

Diagnostic logs

D:\depot-UE4-Mainline>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" D:\depot\Encoder\Binaries\x64\Release\UnitTests.dll /Tests:StabbingTSE_Encoder /Platform:x64 /InIsolation Microsoft (R) Test Execution Command Line Tool Version 15.9.1 Copyright (c) Microsoft Corporation. All rights reserved.

Starting test discovery, please wait... Loading and instantiating ../TestData/StabbingTSE/

.. scene ../TestData/StabbingTSE/ loaded and instantiated in 259.254 millisecond(s)

Loading and instantiating ../TestData/PointedStabbingTSE/

.. scene ../TestData/PointedStabbingTSE/ loaded and instantiated in 286.104 millisecond(s)

Passed StabbingTSE_Encoder Passed PointedStabbingTSE_Encoder

Total tests: 2. Passed: 2. Failed: 0. Skipped: 0. Test Run Successful. Test execution time: 1.6650 Seconds

Environment

Windows 10 Professional. Visual Studio Community 15.9.16.

primalspacesystems avatar Oct 01 '19 19:10 primalspacesystems

@primalspacesystems This is by design, and has the behavior ever since this argument existed. Changing the behavior can possibly break a lot of scenarios for users.

Can you try using the testcasefilter argument instead ?

singhsarab avatar Oct 03 '19 08:10 singhsarab

Using "... /TestCaseFilter:"StabbingTSE_Encoder" /Platform:x64 /InIsolation" generates the exact same results.

Cheers John

primalspacesystems avatar Oct 30 '19 20:10 primalspacesystems

Am experiencing this is there a workaround if you want to run only just one tests

mwaaas avatar Jul 06 '22 10:07 mwaaas

I am in the same situation but TestCaseFilter is working for me. In powershell for me

vstest.console.exe /TestCaseFilter:"Name=$testName" ...

david-risney avatar Jul 27 '22 22:07 david-risney