-
Notifications
You must be signed in to change notification settings - Fork 323
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
Make default testcase filter property name FullyQualifiedName #555
Changes from 2 commits
49d8df5
f99c9e3
6747c9d
6379f12
1963952
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 |
---|---|---|
|
@@ -128,5 +128,26 @@ public void RunSelectedTestsWithPriorityTrait(string runnerFramework, string tar | |
this.InvokeVsTest(arguments); | ||
this.ValidateSummaryStatus(1, 0, 0); | ||
} | ||
|
||
/// <summary> | ||
/// In case TestCaseFilter is provide without any property like Name or ClassName. ex. /TestCaseFilter:"UnitTest1" | ||
/// this command should provide same results as /TestCaseFilter:"FullyQualifiedName~UnitTest1". | ||
/// </summary> | ||
[CustomDataTestMethod] | ||
[NET46TargetFramework] | ||
[NETCORETargetFramework] | ||
public void TestCaseFilterShouldWork_IfOnlyPropertyValueGivenInExpression(string runnerFramework, string targetFramework, string targetRuntime) | ||
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. nit: please remove underscore 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 👍 |
||
{ | ||
AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerFramework, targetFramework, targetRuntime); | ||
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. nit: Looks repetitive. Move to constructor/Test Init? 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. We are using data row here, can't call from .ctor/Setup. |
||
|
||
var arguments = PrepareArguments( | ||
this.GetSampleTestAssembly(), | ||
this.GetTestAdapterPath(), | ||
string.Empty, | ||
this.FrameworkArgValue); | ||
arguments = string.Concat(arguments, " /TestCaseFilter:UnitTest1"); | ||
this.InvokeVsTest(arguments); | ||
this.ValidateSummaryStatus(1, 1, 1); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.TestPlatform.Common.UnitTests.Filtering | ||
{ | ||
using System; | ||
using Microsoft.VisualStudio.TestPlatform.Common.Filtering; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
[TestClass] | ||
public class ConditionTests | ||
{ | ||
[TestMethod] | ||
public void ParseShouldThrownFormatException_OnNullConditionString() | ||
{ | ||
string conditionString = null; | ||
Assert.ThrowsException<FormatException>(() => Condition.Parse(conditionString)); | ||
} | ||
|
||
[TestMethod] | ||
public void ParseShouldThrownFormatException_OnEmptyConditionString() | ||
{ | ||
var conditionString = ""; | ||
Assert.ThrowsException<FormatException>(() => Condition.Parse(conditionString)); | ||
} | ||
|
||
[TestMethod] | ||
public void ParseShouldThrownFormatException_OnIncompleteConditionString() | ||
{ | ||
var conditionString = "PropertyName="; | ||
Assert.ThrowsException<FormatException>( ()=> Condition.Parse(conditionString)); | ||
} | ||
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. nit: space. 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 👍 |
||
|
||
[TestMethod] | ||
public void ParseShouldCreateDefaultCondition_WhenOnlyPropertyValuePassed() | ||
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. nit: no underscores. 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 👍 |
||
{ | ||
var conditionString = "ABC"; | ||
Condition condition = Condition.Parse(conditionString); | ||
Assert.AreEqual(Condition.DefaultPropertyName, condition.Name); | ||
Assert.AreEqual(Operation.Contains, condition.Operation); | ||
Assert.AreEqual(conditionString, condition.Value); | ||
} | ||
|
||
[TestMethod] | ||
public void ParseShouldCreateProperCondition_OnValidConditionString() | ||
{ | ||
var conditionString = "PropertyName=PropertyValue"; | ||
Condition condition = Condition.Parse(conditionString); | ||
Assert.AreEqual("PropertyName", condition.Name); | ||
Assert.AreEqual(Operation.Equal, condition.Operation); | ||
Assert.AreEqual("PropertyValue", condition.Value); | ||
} | ||
} | ||
} |
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.
Isn't there an unit test 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.
test is added in
ConditionTests.cs
.