You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -145,3 +146,49 @@ In above code we defined traits with keys `Category` and `Priority` which can be
145
146
|`dotnet test --filter "FullyQualifiedName~TestClass1\|Category=Nightly"`| Runs tests which have `TestClass1` in FullyQualifiedName **or** Category is Nightly. |
146
147
|`dotnet test --filter "FullyQualifiedName~TestClass1&Category=Nightly"`| Runs tests which have `TestClass1` in FullyQualifiedName **and** Category is Nightly. |
147
148
|`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. |
149
+
150
+
### NUnit
151
+
152
+
```csharp
153
+
namespaceNUnitTestNamespace;
154
+
155
+
publicclassTestClass
156
+
{
157
+
[Property("Priority","1")]
158
+
[Test]
159
+
publicvoidTest1()
160
+
{
161
+
Assert.Pass();
162
+
}
163
+
164
+
[Property("Whatever", "SomeValue")]
165
+
[Test]
166
+
publicvoidTest2()
167
+
{
168
+
Assert.Pass();
169
+
}
170
+
171
+
[Category("SomeCategory")]
172
+
[Test]
173
+
publicvoidTest3()
174
+
{
175
+
Assert.Pass();
176
+
}
177
+
}
178
+
```
179
+
180
+
#### Usage of the filters
181
+
182
+
| Expression | What it does? |
183
+
| ---------- | ------------- |
184
+
|`dotnet test --filter FullyQualifiedName=NUnitTestNamespace.TestClass.Test1`| Runs only the given test |
185
+
|`dotnet test --filter Name=Test1`| Runs all tests whose test name (method) equals `Test1`. |
186
+
|`dotnet test --filter Name=TestClass`| Runs tests within all classes named `TestClass`. |
187
+
|`dotnet test --filter Name=NUnitTestNamespace`| Runs all tests within the namespace `NUnitTestNamespace`. |
188
+
|`dotnet test --filter Priority=1`| Runs tests with property named Priority and value = 1`. |
189
+
|`dotnet test --filter Whatever=TestClass`| Runs tests with property named `Whatever` and value = `SomeValue`. |
190
+
|`dotnet test --filter Category=SomeCategory`| Runs tests with category set to `SomeCategory`. Note: You can also use TestCategory in the filter. |
191
+
192
+
Logical operators works the same as for the other frameworks.
0 commit comments