From d7a5f8350416b72ee8c1f1cb76b7760ce9a604ec Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Tue, 21 Mar 2017 22:25:19 -0500 Subject: [PATCH 01/11] Initial commit --- docs/core/testing/index.md | 2 + docs/core/testing/selective-unit-tests.md | 102 ++++++++++++++++++++++ docs/core/tools/dotnet-test.md | 40 ++++++++- docs/toc.md | 1 + 4 files changed, 143 insertions(+), 2 deletions(-) create mode 100644 docs/core/testing/selective-unit-tests.md diff --git a/docs/core/testing/index.md b/docs/core/testing/index.md index a956ef9a9b33a..59eb886b01666 100644 --- a/docs/core/testing/index.md +++ b/docs/core/testing/index.md @@ -62,3 +62,5 @@ The XUnit team has written a tutorial that shows [how to use xUnit with .NET Core and Visual Studio](http://xunit.github.io/docs/getting-started-dotnet-core.html). If you prefer using MSTest, try the [walkthrough creating unit tests with MSTest and the .NET CLI](unit-testing-with-mstest.md). + +For details on how to run selective unit tests, see [Running selective unit tests](core/testing/selective-unit-tests.md). diff --git a/docs/core/testing/selective-unit-tests.md b/docs/core/testing/selective-unit-tests.md new file mode 100644 index 0000000000000..aa6a9a24cd411 --- /dev/null +++ b/docs/core/testing/selective-unit-tests.md @@ -0,0 +1,102 @@ +--- +title: Running selective unit tests | Microsoft Docs +description: Shows you how to use a filter expression to run selective unit tests with the dotnet test command. +keywords: .NET, .NET Core, unit test, selective test +author: smadala +ms.author: mairaw +ms.date: 03/22/2017 +ms.topic: article +ms.prod: .net-core +ms.devlang: dotnet +ms.assetid: 13d01272-bbf8-456c-a97a-560001d1a7f2 +--- + +# Running selective unit tests + +Following examples use `dotnet test`, if you're using `vstest.console.exe` replace `--filter ` with `--testcasefilter:`. + +## MSTest +```csharp +namespace MSTestNamespace +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class UnitTestClass1 + { + [Priority(2)] + [TestMethod] + public void TestMethod1() + { + } + + [TestCategory("CategoryA")] + [Priority(3)] + [TestMethod] + public void TestMethod2() + { + } + } +} +``` + +| Expression | Result | +| --- | --- | +| `dotnet test --filter Method` | Runs tests whose `FullyQualifiedName` contains `Method`. Available in `vstest 15.1+`. | +| `dotnet test --filter Name~TestMethod1` | Runs tests whose name contains `TestMethod1`. | +| `dotnet test --filter ClassName=MSTestNamespace.UnitTestClass1` | Runs tests which are in class `MSTestNamespace.UnitTestClass1`.
**Note:** ClassName value should have namespace, ClassName=UnitTestClass1 won't work. | +| `dotnet test --filter FullyQualifiedName!=MSTestNamespace.UnitTestClass1.TestMethod1` | Runs all tests excepts `MSTestNamespace.UnitTestClass1.TestMethod1`. | +| `dotnet test --filter TestCategory=CategoryA` | Runs tests which are annotated with `[TestCategory("CategoryA")]` | +| `dotnet test --filter Priority=3` | Runs tests which are annotated with `[Priority(3)]`.**Note:** `Priority~3` is invalid as Priority is int not a string. | + +**Using conditional operators | and  ** + +| Expression | Result | +| --- | --- | +| `dotnet test --filter "FullyQualifiedName~UnitTestClass1|TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in FullyQualifiedName **or** TestCategory is CategoryA. | +| `dotnet test --filter "FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in FullyQualifiedName **and** TestCategory is CategoryA. | +| `dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)|Priority=1"` | Runs tests which have either FullyQualifiedName contains `UnitTestClass1` and TestCategory is CategoryA or Priority is 1. | + +## xUnit +```csharp +namespace XUnitNamespace +{ + public class TestClass1 + { + [Trait("Category", "bvt")] + [Trait("Priority", "1")] + [Fact] + public void foo() + { + } + + [Trait("Category", "Nightly")] + [Trait("Priority", "2")] + [Fact] + public void bar() + { + } + } +} +``` + +| Expression | Result | +| --- | --- | +| `dotnet test --filter DisplayName=XUnitNamespace.TestClass1.Test1` | Runs only one test `XUnitNamespace.TestClass1.Test1`. | +| `dotnet test --filter FullyQualifiedName!=XUnitNamespace.TestClass1.Test1` | Runs all tests except `XUnitNamespace.TestClass1.Test1` | +| `dotnet test --filter DisplayName~TestClass1` | Runs tests whose display name containts `TestClass1`. | + +In the code example, the defined traits with keys `Category` and `Priority` can be used for filtering. + +| Expression | Result | +| --- | --- | +| `dotnet test --filter XUnit` | Runs tests whose `FullyQualifiedName` contains `XUnit`. Available in `vstest 15.1+`. | +| `dotnet test --filter Category=bvt` | Runs tests which has `[Trait("Category", "bvt")]`. | + +**Using conditional operators | and  ** + +| Expression | Result | +| --- | --- | +| `dotnet test --filter "FullyQualifiedName~TestClass1|Category=Nightly"` | Runs tests which has `TestClass1` in FullyQualifiedName **or** Category is Nightly. | +| `dotnet test --filter "FullyQualifiedName~TestClass1&Category=Nightly"` | Runs tests which has `TestClass1` in FullyQualifiedName **and** Category is Nightly. | +| `dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)|Priority=1"` | Runs tests which have either FullyQualifiedName contains `TestClass1` and Category is CategoryA or Priority is 1. | diff --git a/docs/core/tools/dotnet-test.md b/docs/core/tools/dotnet-test.md index d87529f244c00..2240277415e43 100644 --- a/docs/core/tools/dotnet-test.md +++ b/docs/core/tools/dotnet-test.md @@ -50,7 +50,7 @@ List all of the discovered tests in the current project. `--filter ` -Filters out tests in the current project using the given expression. For more information on filtering support, see [Running selective unit tests in Visual Studio using TestCaseFilter](https://aka.ms/vstest-filtering). +Filters out tests in the current project using the given expression. For more information, see the [Filter option details](#filter-option-details) section. For a tutorial on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). `-a|--test-adapter-path ` @@ -92,7 +92,43 @@ Run the tests in the project in the current directory: Run the tests in the `test1` project: -`dotnet test ~/projects/test1/test1.csproj` +`dotnet test ~/projects/test1/test1.csproj` + +## Filter option details + +`--filter ` + +`` is of the format `[|&]`. + +`` is an attribute of the `Test Case`. The following are the properties supported by popular unit test frameworks: + +| Test Framework | Supported properties | +| --- | --- | +| MSTest |
  • FullyQualifiedName
  • Name
  • ClassName
  • Priority
  • TestCategory
| +| Xunit |
  • FullyQualifiedName
  • DisplayName
  • Traits
| + +The `` describes the relationship between the property and the value. + +| Operator | Function | +| --- | --- | +| `=` | Exact match | +| `!=` | Not exact match | +| `~` | Contains | + +`` is a string. All the lookups are case insensitive. + +An expression without an `` is automatically considered as a `contains` on `FullyQualifiedName` property (for example, `dotnet test --filter xyz` is same as `dotnet test --filter FullyQualifiedName~xyz`). + +Expressions can be joined with conditional operators. + +| Operator | Function | +| --- | --- | +| `|` | OR | +| `&` | AND | + +You can enclose expressions in paranthesis when using conditional operators (for example, `(Name~TestMethod1) | (Name~TestMethod2)`). + +For a tutorial on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). ## See also diff --git a/docs/toc.md b/docs/toc.md index cb72389b42aee..7f865465e24d1 100644 --- a/docs/toc.md +++ b/docs/toc.md @@ -157,6 +157,7 @@ ## [Unit Testing](core/testing/index.md) ### [Unit testing with dotnet test and xUnit](core/testing/unit-testing-with-dotnet-test.md) ### [Unit testing with dotnet test and MSTest](core/testing/unit-testing-with-mstest.md) +### [Running selective unit tests](core/testing/selective-unit-tests.md) ## [Versioning](core/versions/index.md) ### [.NET Core Support](core/versions/lts-current.md) ### [đź”§ Servicing](core/versions/servicing.md) From 913e6d8f7dd719c301566efedec30d875d5e2be3 Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Tue, 21 Mar 2017 22:32:46 -0500 Subject: [PATCH 02/11] Update --- docs/core/tools/dotnet-test.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/tools/dotnet-test.md b/docs/core/tools/dotnet-test.md index 2240277415e43..05e5d27768592 100644 --- a/docs/core/tools/dotnet-test.md +++ b/docs/core/tools/dotnet-test.md @@ -50,7 +50,7 @@ List all of the discovered tests in the current project. `--filter ` -Filters out tests in the current project using the given expression. For more information, see the [Filter option details](#filter-option-details) section. For a tutorial on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). +Filters out tests in the current project using the given expression. For more information, see the [Filter option details](#filter-option-details) section. For a additional information and examples on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). `-a|--test-adapter-path ` @@ -128,7 +128,7 @@ Expressions can be joined with conditional operators. You can enclose expressions in paranthesis when using conditional operators (for example, `(Name~TestMethod1) | (Name~TestMethod2)`). -For a tutorial on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). +For a additional information and examples on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). ## See also From 4f3fa923c1feec868f2f6c09e2cc4d6648967984 Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Tue, 21 Mar 2017 22:34:16 -0500 Subject: [PATCH 03/11] Update --- docs/core/tools/dotnet-test.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/dotnet-test.md b/docs/core/tools/dotnet-test.md index 05e5d27768592..11bbffd8553e7 100644 --- a/docs/core/tools/dotnet-test.md +++ b/docs/core/tools/dotnet-test.md @@ -50,7 +50,7 @@ List all of the discovered tests in the current project. `--filter ` -Filters out tests in the current project using the given expression. For more information, see the [Filter option details](#filter-option-details) section. For a additional information and examples on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). +Filters out tests in the current project using the given expression. For option details, see the [Filter option details](#filter-option-details) section. For a additional information and examples on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). `-a|--test-adapter-path ` From 22d0e63aac5a53984a2d94e8a9884cb0155c1465 Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Tue, 21 Mar 2017 22:35:49 -0500 Subject: [PATCH 04/11] Update --- docs/core/testing/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/testing/index.md b/docs/core/testing/index.md index 59eb886b01666..a5ddf9f121160 100644 --- a/docs/core/testing/index.md +++ b/docs/core/testing/index.md @@ -63,4 +63,4 @@ The XUnit team has written a tutorial that shows If you prefer using MSTest, try the [walkthrough creating unit tests with MSTest and the .NET CLI](unit-testing-with-mstest.md). -For details on how to run selective unit tests, see [Running selective unit tests](core/testing/selective-unit-tests.md). +For a additional information and examples on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). From 1aae61d0036658250d800b2ca89325349e9faf6b Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Wed, 22 Mar 2017 00:10:03 -0500 Subject: [PATCH 05/11] Updates --- docs/core/testing/selective-unit-tests.md | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/core/testing/selective-unit-tests.md b/docs/core/testing/selective-unit-tests.md index aa6a9a24cd411..77994218f5240 100644 --- a/docs/core/testing/selective-unit-tests.md +++ b/docs/core/testing/selective-unit-tests.md @@ -13,7 +13,7 @@ ms.assetid: 13d01272-bbf8-456c-a97a-560001d1a7f2 # Running selective unit tests -Following examples use `dotnet test`, if you're using `vstest.console.exe` replace `--filter ` with `--testcasefilter:`. +The following examples use `dotnet test`. If you're using `vstest.console.exe`, replace `--filter ` with `--testcasefilter:`. ## MSTest ```csharp @@ -44,18 +44,18 @@ namespace MSTestNamespace | --- | --- | | `dotnet test --filter Method` | Runs tests whose `FullyQualifiedName` contains `Method`. Available in `vstest 15.1+`. | | `dotnet test --filter Name~TestMethod1` | Runs tests whose name contains `TestMethod1`. | -| `dotnet test --filter ClassName=MSTestNamespace.UnitTestClass1` | Runs tests which are in class `MSTestNamespace.UnitTestClass1`.
**Note:** ClassName value should have namespace, ClassName=UnitTestClass1 won't work. | -| `dotnet test --filter FullyQualifiedName!=MSTestNamespace.UnitTestClass1.TestMethod1` | Runs all tests excepts `MSTestNamespace.UnitTestClass1.TestMethod1`. | -| `dotnet test --filter TestCategory=CategoryA` | Runs tests which are annotated with `[TestCategory("CategoryA")]` | -| `dotnet test --filter Priority=3` | Runs tests which are annotated with `[Priority(3)]`.**Note:** `Priority~3` is invalid as Priority is int not a string. | +| `dotnet test --filter ClassName=MSTestNamespace.UnitTestClass1` | Runs tests which are in class `MSTestNamespace.UnitTestClass1`.
**Note:** The `ClassName` value should have namespace, so `ClassName=UnitTestClass1` won't work. | +| `dotnet test --filter FullyQualifiedName!=MSTestNamespace.UnitTestClass1.TestMethod1` | Runs all tests except `MSTestNamespace.UnitTestClass1.TestMethod1`. | +| `dotnet test --filter TestCategory=CategoryA` | Runs tests which are annotated with `[TestCategory("CategoryA")]`. | +| `dotnet test --filter Priority=3` | Runs tests which are annotated with `[Priority(3)]`.
**Note:** `Priority~3` is an invalid value as is int not a string. | -**Using conditional operators | and  ** +**Using conditional operators | and &** | Expression | Result | | --- | --- | -| `dotnet test --filter "FullyQualifiedName~UnitTestClass1|TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in FullyQualifiedName **or** TestCategory is CategoryA. | -| `dotnet test --filter "FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in FullyQualifiedName **and** TestCategory is CategoryA. | -| `dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)|Priority=1"` | Runs tests which have either FullyQualifiedName contains `UnitTestClass1` and TestCategory is CategoryA or Priority is 1. | +| `dotnet test --filter "FullyQualifiedName~UnitTestClass1\|TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **or** `TestCategory` is `CategoryA`. | +| `dotnet test --filter "FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **and** `TestCategory` is `CategoryA`. | +| `dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)\|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `UnitTestClass1` **and** `TestCategory` is `CategoryA` **or** `Priority` is 1. | ## xUnit ```csharp @@ -82,9 +82,9 @@ namespace XUnitNamespace | Expression | Result | | --- | --- | -| `dotnet test --filter DisplayName=XUnitNamespace.TestClass1.Test1` | Runs only one test `XUnitNamespace.TestClass1.Test1`. | -| `dotnet test --filter FullyQualifiedName!=XUnitNamespace.TestClass1.Test1` | Runs all tests except `XUnitNamespace.TestClass1.Test1` | -| `dotnet test --filter DisplayName~TestClass1` | Runs tests whose display name containts `TestClass1`. | +| `dotnet test --filter DisplayName=XUnitNamespace.TestClass1.Test1` | Runs only one test, `XUnitNamespace.TestClass1.Test1`. | +| `dotnet test --filter FullyQualifiedName!=XUnitNamespace.TestClass1.Test1` | Runs all tests except `XUnitNamespace.TestClass1.Test1`. | +| `dotnet test --filter DisplayName~TestClass1` | Runs tests whose display name contains `TestClass1`. | In the code example, the defined traits with keys `Category` and `Priority` can be used for filtering. @@ -97,6 +97,6 @@ In the code example, the defined traits with keys `Category` and `Priority` can | Expression | Result | | --- | --- | -| `dotnet test --filter "FullyQualifiedName~TestClass1|Category=Nightly"` | Runs tests which has `TestClass1` in FullyQualifiedName **or** Category is Nightly. | -| `dotnet test --filter "FullyQualifiedName~TestClass1&Category=Nightly"` | Runs tests which has `TestClass1` in FullyQualifiedName **and** Category is Nightly. | -| `dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)|Priority=1"` | Runs tests which have either FullyQualifiedName contains `TestClass1` and Category is CategoryA or Priority is 1. | +| `dotnet test --filter "FullyQualifiedName~TestClass1\|Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **or** `Category` is `Nightly`. | +| `dotnet test --filter "FullyQualifiedName~TestClass1&Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **and** `Category` is `Nightly`. | +| `dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)\|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `TestClass1` **and** `Category` is `CategoryA` **or** `Priority` is 1. | From fe4ec340cdafa00cbf35b620090eb4dc35a9735e Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Wed, 22 Mar 2017 00:48:18 -0500 Subject: [PATCH 06/11] Updates --- docs/core/testing/selective-unit-tests.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/core/testing/selective-unit-tests.md b/docs/core/testing/selective-unit-tests.md index 77994218f5240..7a2236f7d9aa5 100644 --- a/docs/core/testing/selective-unit-tests.md +++ b/docs/core/testing/selective-unit-tests.md @@ -53,9 +53,9 @@ namespace MSTestNamespace | Expression | Result | | --- | --- | -| `dotnet test --filter "FullyQualifiedName~UnitTestClass1\|TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **or** `TestCategory` is `CategoryA`. | +| `dotnet test --filter "FullyQualifiedName~UnitTestClass1|TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **or** `TestCategory` is `CategoryA`. | | `dotnet test --filter "FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **and** `TestCategory` is `CategoryA`. | -| `dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)\|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `UnitTestClass1` **and** `TestCategory` is `CategoryA` **or** `Priority` is 1. | +| `dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `UnitTestClass1` **and** `TestCategory` is `CategoryA` **or** `Priority` is 1. | ## xUnit ```csharp @@ -97,6 +97,6 @@ In the code example, the defined traits with keys `Category` and `Priority` can | Expression | Result | | --- | --- | -| `dotnet test --filter "FullyQualifiedName~TestClass1\|Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **or** `Category` is `Nightly`. | +| `dotnet test --filter "FullyQualifiedName~TestClass1|Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **or** `Category` is `Nightly`. | | `dotnet test --filter "FullyQualifiedName~TestClass1&Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **and** `Category` is `Nightly`. | -| `dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)\|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `TestClass1` **and** `Category` is `CategoryA` **or** `Priority` is 1. | +| `dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `TestClass1` **and** `Category` is `CategoryA` **or** `Priority` is 1. | From 6ecbf115b4c9812c2e6f5cdd2081ae84935f08b6 Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Wed, 22 Mar 2017 01:27:16 -0500 Subject: [PATCH 07/11] Updates --- docs/core/testing/selective-unit-tests.md | 56 ++++++++++++++++++----- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/docs/core/testing/selective-unit-tests.md b/docs/core/testing/selective-unit-tests.md index 7a2236f7d9aa5..c37a3cb661e2d 100644 --- a/docs/core/testing/selective-unit-tests.md +++ b/docs/core/testing/selective-unit-tests.md @@ -51,11 +51,28 @@ namespace MSTestNamespace **Using conditional operators | and &** -| Expression | Result | -| --- | --- | -| `dotnet test --filter "FullyQualifiedName~UnitTestClass1|TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **or** `TestCategory` is `CategoryA`. | -| `dotnet test --filter "FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **and** `TestCategory` is `CategoryA`. | -| `dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `UnitTestClass1` **and** `TestCategory` is `CategoryA` **or** `Priority` is 1. | + + + + + + + + + + + + + + + + + + + + + +
ExpressionResult
dotnet test --filter "FullyQualifiedName~UnitTestClass1|TestCategory=CategoryA"Runs tests which have UnitTestClass1 in FullyQualifiedName or TestCategory is CategoryA.
dotnet test --filter "FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA"Runs tests which have UnitTestClass1 in FullyQualifiedName and TestCategory is CategoryA.
dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)|Priority=1"Runs tests which have either FullyQualifiedName containing UnitTestClass1 and TestCategory is CategoryA or Priority is 1.
## xUnit ```csharp @@ -93,10 +110,27 @@ In the code example, the defined traits with keys `Category` and `Priority` can | `dotnet test --filter XUnit` | Runs tests whose `FullyQualifiedName` contains `XUnit`. Available in `vstest 15.1+`. | | `dotnet test --filter Category=bvt` | Runs tests which has `[Trait("Category", "bvt")]`. | -**Using conditional operators | and  ** +**Using conditional operators | and &** -| Expression | Result | -| --- | --- | -| `dotnet test --filter "FullyQualifiedName~TestClass1|Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **or** `Category` is `Nightly`. | -| `dotnet test --filter "FullyQualifiedName~TestClass1&Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **and** `Category` is `Nightly`. | -| `dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `TestClass1` **and** `Category` is `CategoryA` **or** `Priority` is 1. | + + + + + + + + + + + + + + + + + + + + + +
ExpressionResult
dotnet test --filter "FullyQualifiedName~TestClass1|Category=Nightly"Runs tests which has TestClass1 in FullyQualifiedName or Category is Nightly.
dotnet test --filter "FullyQualifiedName~TestClass1&Category=Nightly"Runs tests which has TestClass1 in FullyQualifiedName and Category is Nightly.
dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)|Priority=1"Runs tests which have either FullyQualifiedName containing TestClass1 and Category is CategoryA or Priority is 1.
From 1d849ba794c0f4970847be8d4bce6394ea5e605c Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Wed, 22 Mar 2017 17:24:47 -0500 Subject: [PATCH 08/11] Updates --- docs/core/testing/selective-unit-tests.md | 54 +++++------------------ 1 file changed, 10 insertions(+), 44 deletions(-) diff --git a/docs/core/testing/selective-unit-tests.md b/docs/core/testing/selective-unit-tests.md index c37a3cb661e2d..4040a9d473aa1 100644 --- a/docs/core/testing/selective-unit-tests.md +++ b/docs/core/testing/selective-unit-tests.md @@ -51,28 +51,11 @@ namespace MSTestNamespace **Using conditional operators | and &** - - - - - - - - - - - - - - - - - - - - - -
ExpressionResult
dotnet test --filter "FullyQualifiedName~UnitTestClass1|TestCategory=CategoryA"Runs tests which have UnitTestClass1 in FullyQualifiedName or TestCategory is CategoryA.
dotnet test --filter "FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA"Runs tests which have UnitTestClass1 in FullyQualifiedName and TestCategory is CategoryA.
dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)|Priority=1"Runs tests which have either FullyQualifiedName containing UnitTestClass1 and TestCategory is CategoryA or Priority is 1.
+| Expression | Result | +| --- | --- | +| dotnet test --filter "FullyQualifiedName~UnitTestClass1|TestCategory=CategoryA" | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **or** `TestCategory` is `CategoryA`. | +| `dotnet test --filter "FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **and** `TestCategory` is `CategoryA`. | +| `dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `UnitTestClass1` **and** `TestCategory` is `CategoryA` **or** `Priority` is 1. | ## xUnit ```csharp @@ -112,25 +95,8 @@ In the code example, the defined traits with keys `Category` and `Priority` can **Using conditional operators | and &** - - - - - - - - - - - - - - - - - - - - - -
ExpressionResult
dotnet test --filter "FullyQualifiedName~TestClass1|Category=Nightly"Runs tests which has TestClass1 in FullyQualifiedName or Category is Nightly.
dotnet test --filter "FullyQualifiedName~TestClass1&Category=Nightly"Runs tests which has TestClass1 in FullyQualifiedName and Category is Nightly.
dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)|Priority=1"Runs tests which have either FullyQualifiedName containing TestClass1 and Category is CategoryA or Priority is 1.
+| Expression | Result | +| --- | --- | +| dotnet test --filter "FullyQualifiedName~TestClass1|Category=Nightly" | Runs tests which has `TestClass1` in `FullyQualifiedName` **or** `Category` is `Nightly`. | +| `dotnet test --filter "FullyQualifiedName~TestClass1&Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **and** `Category` is `Nightly`. | +| dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)|Priority=1" | Runs tests which have either `FullyQualifiedName` containing `TestClass1` **and** `Category` is `CategoryA` **or** `Priority` is 1. | From b84e7ac75262e39bd8ed8f58465ca0b43074e5d8 Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Tue, 16 May 2017 14:57:25 -0500 Subject: [PATCH 09/11] React to feedback --- docs/core/testing/index.md | 49 ++++------------------- docs/core/testing/selective-unit-tests.md | 16 ++++---- docs/core/tools/dotnet-test.md | 36 ++++++++--------- 3 files changed, 35 insertions(+), 66 deletions(-) diff --git a/docs/core/testing/index.md b/docs/core/testing/index.md index a5ddf9f121160..61c5c640c9c0d 100644 --- a/docs/core/testing/index.md +++ b/docs/core/testing/index.md @@ -13,54 +13,21 @@ ms.assetid: 815ac74c-4bd9-4a94-a87c-78288b27c0e2 # Unit Testing in .NET Core -By [Steve Smith](http://ardalis.com) and [Bill Wagner](https://github.com/BillWagner) - -.NET Core has been designed with testability in mind, so that creating -unit tests for your applications is easier than ever before. This article -briefly introduces unit tests (and how they differ from other kinds of tests). -Linked resources demonstrates how to add a test project to your solution and -then run unit tests using either the command line or Visual Studio. +.NET Core has been designed with testability in mind, so that creating unit tests for your applications is easier than ever before. This article briefly introduces unit tests (and how they differ from other kinds of tests). Linked resources demonstrates how to add a test project to your solution and then run unit tests using either the command line or Visual Studio. ## Getting Started with Testing -Having a suite of automated tests is one of the best ways to ensure a -software application does what its authors intended it to do. There are -many different kinds of tests for software applications, including integration -tests, web tests, load tests, and many others. At the lowest level are -unit tests, which test individual software components or methods. Unit -tests should only test code within the developer’s control, and should -not test infrastructure concerns, like databases, file systems, or -network resources. Unit tests may be written using -[Test Driven Development (TDD)](http://deviq.com/test-driven-development/), -or they can be added to existing code to confirm its correctness. In -either case, they should be small, well-named, and fast, since ideally -you will want to be able to run hundreds of them before pushing your -changes into the project’s shared code repository. +Having a suite of automated tests is one of the best ways to ensure a software application does what its authors intended it to do. There are many different kinds of tests for software applications, including integration tests, web tests, load tests, and many others. At the lowest level are unit tests, which test individual software components or methods. Unit tests should only test code within the developer’s control, and should not test infrastructure concerns, like databases, file systems, or network resources. Unit tests may be written using [Test Driven Development (TDD)](http://deviq.com/test-driven-development/), or they can be added to existing code to confirm its correctness. In either case, they should be small, well-named, and fast, since ideally you will want to be able to run hundreds of them before pushing your changes into the project’s shared code repository. > [!NOTE] -> Developers often struggle with coming up with good names for their -> test classes and methods. As a starting point, the ASP.NET product -> team follows -> [these conventions](https://github.com/aspnet/Home/wiki/Engineering-guidelines#unit-tests-and-functional-tests). +> Developers often struggle with coming up with good names for their test classes and methods. As a starting point, the ASP.NET product team follows [these conventions](https://github.com/aspnet/Home/wiki/Engineering-guidelines#unit-tests-and-functional-tests). -When writing unit tests, be careful you don’t accidentally introduce -dependencies on infrastructure. These tend to make tests slower and -more brittle, and thus should be reserved for integration tests. You -can avoid these hidden dependencies in your application code by following -the [Explicit Dependencies Principle](http://deviq.com/explicit-dependencies-principle/) -and using [Dependency Injection](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection) -to request your dependencies from the framework. You can also keep your -unit tests in a separate project from your integration tests, and ensure -your unit test project doesn’t have references to or dependencies on -infrastructure packages. +When writing unit tests, be careful you don’t accidentally introduce dependencies on infrastructure. These tend to make tests slower and more brittle, and thus should be reserved for integration tests. You can avoid these hidden dependencies in your application code by following the [Explicit Dependencies Principle](http://deviq.com/explicit-dependencies-principle/) and using [Dependency Injection](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection) to request your dependencies from the framework. You can also keep your unit tests in a separate project from your integration tests, and ensure your unit test project doesn’t have references to or dependencies on infrastructure packages. Learn more about unit testing in .NET Core projects: -Try this [walkthrough creating unit tests with xUnit and the .NET CLI](unit-testing-with-dotnet-test.md). - -The XUnit team has written a tutorial that shows +* Try this [walkthrough creating unit tests with xUnit and the .NET CLI](unit-testing-with-dotnet-test.md). +* The XUnit team has written a tutorial that shows [how to use xUnit with .NET Core and Visual Studio](http://xunit.github.io/docs/getting-started-dotnet-core.html). - -If you prefer using MSTest, try the [walkthrough creating unit tests with MSTest and the .NET CLI](unit-testing-with-mstest.md). - -For a additional information and examples on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). +* If you prefer using MSTest, try the [walkthrough creating unit tests with MSTest and the .NET CLI](unit-testing-with-mstest.md). +* For a additional information and examples on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). diff --git a/docs/core/testing/selective-unit-tests.md b/docs/core/testing/selective-unit-tests.md index 4040a9d473aa1..8a1753e64284a 100644 --- a/docs/core/testing/selective-unit-tests.md +++ b/docs/core/testing/selective-unit-tests.md @@ -16,6 +16,7 @@ ms.assetid: 13d01272-bbf8-456c-a97a-560001d1a7f2 The following examples use `dotnet test`. If you're using `vstest.console.exe`, replace `--filter ` with `--testcasefilter:`. ## MSTest + ```csharp namespace MSTestNamespace { @@ -41,7 +42,7 @@ namespace MSTestNamespace ``` | Expression | Result | -| --- | --- | +| ---------- | ------ | | `dotnet test --filter Method` | Runs tests whose `FullyQualifiedName` contains `Method`. Available in `vstest 15.1+`. | | `dotnet test --filter Name~TestMethod1` | Runs tests whose name contains `TestMethod1`. | | `dotnet test --filter ClassName=MSTestNamespace.UnitTestClass1` | Runs tests which are in class `MSTestNamespace.UnitTestClass1`.
**Note:** The `ClassName` value should have namespace, so `ClassName=UnitTestClass1` won't work. | @@ -52,12 +53,13 @@ namespace MSTestNamespace **Using conditional operators | and &** | Expression | Result | -| --- | --- | +| ---------- | ------ | | dotnet test --filter "FullyQualifiedName~UnitTestClass1|TestCategory=CategoryA" | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **or** `TestCategory` is `CategoryA`. | | `dotnet test --filter "FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **and** `TestCategory` is `CategoryA`. | -| `dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `UnitTestClass1` **and** `TestCategory` is `CategoryA` **or** `Priority` is 1. | +| `dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)%7CPriority=1"` | Runs tests which have either `FullyQualifiedName` containing `UnitTestClass1` **and** `TestCategory` is `CategoryA` **or** `Priority` is 1. | ## xUnit + ```csharp namespace XUnitNamespace { @@ -81,7 +83,7 @@ namespace XUnitNamespace ``` | Expression | Result | -| --- | --- | +| ---------- | ------ | | `dotnet test --filter DisplayName=XUnitNamespace.TestClass1.Test1` | Runs only one test, `XUnitNamespace.TestClass1.Test1`. | | `dotnet test --filter FullyQualifiedName!=XUnitNamespace.TestClass1.Test1` | Runs all tests except `XUnitNamespace.TestClass1.Test1`. | | `dotnet test --filter DisplayName~TestClass1` | Runs tests whose display name contains `TestClass1`. | @@ -89,14 +91,14 @@ namespace XUnitNamespace In the code example, the defined traits with keys `Category` and `Priority` can be used for filtering. | Expression | Result | -| --- | --- | +| ---------- | ------ | | `dotnet test --filter XUnit` | Runs tests whose `FullyQualifiedName` contains `XUnit`. Available in `vstest 15.1+`. | -| `dotnet test --filter Category=bvt` | Runs tests which has `[Trait("Category", "bvt")]`. | +| `dotnet test --filter Category=bvt` | Runs tests which have `[Trait("Category", "bvt")]`. | **Using conditional operators | and &** | Expression | Result | -| --- | --- | +| ---------- | ------ | | dotnet test --filter "FullyQualifiedName~TestClass1|Category=Nightly" | Runs tests which has `TestClass1` in `FullyQualifiedName` **or** `Category` is `Nightly`. | | `dotnet test --filter "FullyQualifiedName~TestClass1&Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **and** `Category` is `Nightly`. | | dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)|Priority=1" | Runs tests which have either `FullyQualifiedName` containing `TestClass1` **and** `Category` is `CategoryA` **or** `Priority` is 1. | diff --git a/docs/core/tools/dotnet-test.md b/docs/core/tools/dotnet-test.md index 11bbffd8553e7..2629227c862d5 100644 --- a/docs/core/tools/dotnet-test.md +++ b/docs/core/tools/dotnet-test.md @@ -50,7 +50,7 @@ List all of the discovered tests in the current project. `--filter ` -Filters out tests in the current project using the given expression. For option details, see the [Filter option details](#filter-option-details) section. For a additional information and examples on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). +Filters out tests in the current project using the given expression. For for information, see the [Filter option details](#filter-option-details) section. For additional information and examples on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). `-a|--test-adapter-path ` @@ -98,33 +98,33 @@ Run the tests in the `test1` project: `--filter ` -`` is of the format `[|&]`. +`` has the format `[|&]`. `` is an attribute of the `Test Case`. The following are the properties supported by popular unit test frameworks: -| Test Framework | Supported properties | -| --- | --- | -| MSTest |
  • FullyQualifiedName
  • Name
  • ClassName
  • Priority
  • TestCategory
| -| Xunit |
  • FullyQualifiedName
  • DisplayName
  • Traits
| +| Test Framework | Supported properties | +| :------------: | --------------------------------------------------------------------------------------------------------- | +| MSTest |
  • FullyQualifiedName
  • Name
  • ClassName
  • Priority
  • TestCategory
| +| Xunit |
  • FullyQualifiedName
  • DisplayName
  • Traits
| -The `` describes the relationship between the property and the value. +The `` describes the relationship between the property and the value: -| Operator | Function | -| --- | --- | -| `=` | Exact match | -| `!=` | Not exact match | -| `~` | Contains | +| Operator | Function | +| :------: | --------------- | +| `=` | Exact match | +| `!=` | Not exact match | +| `~` | Contains | `` is a string. All the lookups are case insensitive. An expression without an `` is automatically considered as a `contains` on `FullyQualifiedName` property (for example, `dotnet test --filter xyz` is same as `dotnet test --filter FullyQualifiedName~xyz`). -Expressions can be joined with conditional operators. +Expressions can be joined with conditional operators: | Operator | Function | -| --- | --- | -| `|` | OR | -| `&` | AND | +| :------: | :------: | +| `|` | OR | +| `&` | AND | You can enclose expressions in paranthesis when using conditional operators (for example, `(Name~TestMethod1) | (Name~TestMethod2)`). @@ -132,5 +132,5 @@ For a additional information and examples on how to use selective unit test filt ## See also -* [Target frameworks](../../standard/frameworks.md) -* [Runtime IDentifier (RID) catalog](../rid-catalog.md) \ No newline at end of file +[Frameworks and Targets](../../standard/frameworks.md) +[.NET Core Runtime IDentifier (RID) catalog](../rid-catalog.md) From b5671f0602db55e5458c15f157b5359f08f6d528 Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Tue, 16 May 2017 18:17:28 -0500 Subject: [PATCH 10/11] Updates --- docs/core/testing/selective-unit-tests.md | 12 ++++++------ docs/core/tools/dotnet-test.md | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/core/testing/selective-unit-tests.md b/docs/core/testing/selective-unit-tests.md index 8a1753e64284a..c897868a553e7 100644 --- a/docs/core/testing/selective-unit-tests.md +++ b/docs/core/testing/selective-unit-tests.md @@ -45,18 +45,18 @@ namespace MSTestNamespace | ---------- | ------ | | `dotnet test --filter Method` | Runs tests whose `FullyQualifiedName` contains `Method`. Available in `vstest 15.1+`. | | `dotnet test --filter Name~TestMethod1` | Runs tests whose name contains `TestMethod1`. | -| `dotnet test --filter ClassName=MSTestNamespace.UnitTestClass1` | Runs tests which are in class `MSTestNamespace.UnitTestClass1`.
**Note:** The `ClassName` value should have namespace, so `ClassName=UnitTestClass1` won't work. | +| `dotnet test --filter ClassName=MSTestNamespace.UnitTestClass1` | Runs tests which are in class `MSTestNamespace.UnitTestClass1`.
**Note:** The `ClassName` value should have a namespace, so `ClassName=UnitTestClass1` won't work. | | `dotnet test --filter FullyQualifiedName!=MSTestNamespace.UnitTestClass1.TestMethod1` | Runs all tests except `MSTestNamespace.UnitTestClass1.TestMethod1`. | | `dotnet test --filter TestCategory=CategoryA` | Runs tests which are annotated with `[TestCategory("CategoryA")]`. | -| `dotnet test --filter Priority=3` | Runs tests which are annotated with `[Priority(3)]`.
**Note:** `Priority~3` is an invalid value as is int not a string. | +| `dotnet test --filter Priority=3` | Runs tests which are annotated with `[Priority(3)]`.
**Note:** `Priority~3` is an invalid value, as it isn't a string. | **Using conditional operators | and &** | Expression | Result | | ---------- | ------ | -| dotnet test --filter "FullyQualifiedName~UnitTestClass1|TestCategory=CategoryA" | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **or** `TestCategory` is `CategoryA`. | +| `dotnet test --filter "FullyQualifiedName~UnitTestClass1|TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **or** `TestCategory` is `CategoryA`. | | `dotnet test --filter "FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **and** `TestCategory` is `CategoryA`. | -| `dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)%7CPriority=1"` | Runs tests which have either `FullyQualifiedName` containing `UnitTestClass1` **and** `TestCategory` is `CategoryA` **or** `Priority` is 1. | +| `dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `UnitTestClass1` **and** `TestCategory` is `CategoryA` **or** `Priority` is 1. | ## xUnit @@ -99,6 +99,6 @@ In the code example, the defined traits with keys `Category` and `Priority` can | Expression | Result | | ---------- | ------ | -| dotnet test --filter "FullyQualifiedName~TestClass1|Category=Nightly" | Runs tests which has `TestClass1` in `FullyQualifiedName` **or** `Category` is `Nightly`. | +| `dotnet test --filter "FullyQualifiedName~TestClass1|Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **or** `Category` is `Nightly`. | | `dotnet test --filter "FullyQualifiedName~TestClass1&Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **and** `Category` is `Nightly`. | -| dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)|Priority=1" | Runs tests which have either `FullyQualifiedName` containing `TestClass1` **and** `Category` is `CategoryA` **or** `Priority` is 1. | +| `dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `TestClass1` **and** `Category` is `CategoryA` **or** `Priority` is 1. | diff --git a/docs/core/tools/dotnet-test.md b/docs/core/tools/dotnet-test.md index 71ed18b643cd1..6f21d691431b2 100644 --- a/docs/core/tools/dotnet-test.md +++ b/docs/core/tools/dotnet-test.md @@ -50,7 +50,7 @@ List all of the discovered tests in the current project. `--filter ` -Filters out tests in the current project using the given expression. For for information, see the [Filter option details](#filter-option-details) section. For additional information and examples on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). +Filters out tests in the current project using the given expression. For more information, see the [Filter option details](#filter-option-details) section. For additional information and examples on how to use selective unit test filtering, see [Running selective unit tests](../testing/selective-unit-tests.md). `-a|--test-adapter-path ` From bed7b63ad14273733db6fa4d06be35867442abaf Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Wed, 17 May 2017 16:04:05 -0500 Subject: [PATCH 11/11] Working on pipes --- docs/core/testing/selective-unit-tests.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/core/testing/selective-unit-tests.md b/docs/core/testing/selective-unit-tests.md index c897868a553e7..4b0757a9d811d 100644 --- a/docs/core/testing/selective-unit-tests.md +++ b/docs/core/testing/selective-unit-tests.md @@ -54,9 +54,9 @@ namespace MSTestNamespace | Expression | Result | | ---------- | ------ | -| `dotnet test --filter "FullyQualifiedName~UnitTestClass1|TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **or** `TestCategory` is `CategoryA`. | +| dotnet test --filter "FullyQualifiedName~UnitTestClass1|TestCategory=CategoryA" | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **or** `TestCategory` is `CategoryA`. | | `dotnet test --filter "FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA"` | Runs tests which have `UnitTestClass1` in `FullyQualifiedName` **and** `TestCategory` is `CategoryA`. | -| `dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `UnitTestClass1` **and** `TestCategory` is `CategoryA` **or** `Priority` is 1. | +| dotnet test --filter "(FullyQualifiedName~UnitTestClass1&TestCategory=CategoryA)|Priority=1" | Runs tests which have either `FullyQualifiedName` containing `UnitTestClass1` **and** `TestCategory` is `CategoryA` **or** `Priority` is 1. | ## xUnit @@ -99,6 +99,6 @@ In the code example, the defined traits with keys `Category` and `Priority` can | Expression | Result | | ---------- | ------ | -| `dotnet test --filter "FullyQualifiedName~TestClass1|Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **or** `Category` is `Nightly`. | +| dotnet test --filter "FullyQualifiedName~TestClass1|Category=Nightly" | Runs tests which has `TestClass1` in `FullyQualifiedName` **or** `Category` is `Nightly`. | | `dotnet test --filter "FullyQualifiedName~TestClass1&Category=Nightly"` | Runs tests which has `TestClass1` in `FullyQualifiedName` **and** `Category` is `Nightly`. | -| `dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)|Priority=1"` | Runs tests which have either `FullyQualifiedName` containing `TestClass1` **and** `Category` is `CategoryA` **or** `Priority` is 1. | +| dotnet test --filter "(FullyQualifiedName~TestClass1&Category=Nightly)|Priority=1" | Runs tests which have either `FullyQualifiedName` containing `TestClass1` **and** `Category` is `CategoryA` **or** `Priority` is 1. |