-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show proper warning message no tests to run because testcasefilter #1656
Changes from all commits
28a448e
7a22a14
559545a
e17bd0d
3e11ed9
a11bcf8
fcb2595
2844597
971db88
48c1c73
d721871
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution | |
|
||
using ObjectModel.Client; | ||
using ObjectModel.Logging; | ||
|
||
using Utilities; | ||
using CrossPlatEngineResources = Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources.Resources; | ||
|
||
internal class RunTestsWithSources : BaseRunTests | ||
|
@@ -62,10 +62,26 @@ protected override void BeforeRaisingTestRunComplete(bool exceptionsHitDuringRun | |
if (!exceptionsHitDuringRunTests && this.executorUriVsSourceList?.Count > 0 && !this.IsCancellationRequested | ||
&& this.TestRunCache?.TotalExecutedTests <= 0) | ||
{ | ||
IEnumerable<string> sources = new List<string>(); | ||
var sourcesArray = this.adapterSourceMap.Values.Aggregate(sources, (current, enumerable) => current.Concat(enumerable)).ToArray(); | ||
var sourcesString = string.Join(" ", sourcesArray); | ||
this.LogWarningOnNoTestsExecuted(); | ||
} | ||
} | ||
|
||
private void LogWarningOnNoTestsExecuted() | ||
{ | ||
IEnumerable<string> sources = new List<string>(); | ||
var sourcesArray = this.adapterSourceMap.Values | ||
.Aggregate(sources, (current, enumerable) => current.Concat(enumerable)).ToArray(); | ||
var sourcesString = string.Join(" ", sourcesArray); | ||
|
||
if (this.TestExecutionContext.TestCaseFilter != null) | ||
{ | ||
var testCaseFilterToShow = TestCaseFilterDeterminer.ShortenTestCaseFilterIfRequired(this.TestExecutionContext.TestCaseFilter); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to LogWarningOnNoTestsDiscoveredWithTestCaseFilter, should there be LogWarningOnNoTestsExecutedWithTestCaseFilter method? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
this.TestRunEventsHandler?.HandleLogMessage( | ||
TestMessageLevel.Warning, | ||
string.Format(CrossPlatEngineResources.NoTestsAvailableForGivenTestCaseFilter, testCaseFilterToShow, sourcesString)); | ||
} | ||
else | ||
{ | ||
this.TestRunEventsHandler?.HandleLogMessage( | ||
TestMessageLevel.Warning, | ||
string.Format( | ||
|
@@ -170,5 +186,22 @@ private Dictionary<Tuple<Uri, string>, IEnumerable<string>> GetExecutorVsSources | |
|
||
return result; | ||
} | ||
|
||
private static string TestCaseFilterToShow(string testCaseFilter) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is dead code. |
||
{ | ||
var maxTestCaseFilterToShowLength = 63; | ||
string testCaseFilterToShow; | ||
|
||
if (testCaseFilter.Length > maxTestCaseFilterToShowLength) | ||
{ | ||
testCaseFilterToShow = testCaseFilter.Substring(0, maxTestCaseFilterToShowLength - 3) + "..."; | ||
} | ||
else | ||
{ | ||
testCaseFilterToShow = testCaseFilter; | ||
} | ||
|
||
return testCaseFilterToShow; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,10 @@ | |
<!--<EnableCodeAnalysis>true</EnableCodeAnalysis>--> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Resources\Resources.resx" /> | ||
<EmbeddedResource Include="Resources\Resources.resx"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To Make |
||
<Generator>ResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
</EmbeddedResource> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Microsoft.TestPlatform.CommunicationUtilities\Microsoft.TestPlatform.CommunicationUtilities.csproj" /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change required to show proper diagnostic info on test failures of vstest repo. Related to microsoft/testfx#451 . We should fix the trx parsing logic in vstest repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets create a tracking bug for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created one #1658