What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
To test several inputs with one NUnit method, add a [TestCase] attribute for each input set; NUnit discovers each set as a separate test. To execute several discovered tests, run dotnet test, select them in Visual Studio Test Explorer, or filter by category with NUnit’s selection language.
Define several cases with repeated [TestCase] attributes
For a handful of fixed, readable examples, put one [TestCase(...)] above the test method for each argument set. Each attribute creates a separate invocation of that method.
using NUnit.Framework;
public class DivisionTests
{
[TestCase(12, 3, 4)]
[TestCase(12, 2, 6)]
[TestCase(12, 4, 3)]
public void Divide_ReturnsExpectedQuotient(int numerator, int denominator, int expected)
{
Assert.That(numerator / denominator, Is.EqualTo(expected));
}
}
The method parameters correspond, in order, to the values in each attribute. The assertion runs independently for each set, so a failure identifies a particular case rather than stopping a loop inside one test. NUnit describes the behavior simply: multiple argument sets create multiple tests (Parameterized Tests).
Use [TestCaseSource] for larger or reusable data
When cases are lengthy, shared, or generated, place them in a separate source instead of crowding the method declaration. The source can be a field, property, or method that returns an enumerable of compatible arguments. Current NUnit documentation requires the source member to be static.
#1 Best Overall
- Used Book in Good Condition
using System.Collections.Generic;
using NUnit.Framework;
public class DivisionSourceTests
{
private static IEnumerable<TestCaseData> DivisionCases()
{
yield return new TestCaseData(12, 3, 4);
yield return new TestCaseData(12, 2, 6);
yield return new TestCaseData(12, 4, 3);
}
[TestCaseSource(nameof(DivisionCases))]
public void Divide_ReturnsExpectedQuotient(int numerator, int denominator, int expected)
{
Assert.That(numerator / denominator, Is.EqualTo(expected));
}
}
nameof keeps the source reference refactor-safe. Ensure each yielded case supplies values assignable to the test method’s parameters. See NUnit’s TestCaseSource documentation for source forms and constraints.
Choose between the two attributes
| Use | Best fit | Data location |
|---|---|---|
[TestCase] |
A few stable, simple cases | Inline above the method |
[TestCaseSource] |
A larger, shared, or generated set | A separate static field, property, or method |
Run all tests or select multiple tests
Run the project from the command line
From the directory containing the test project, run:
dotnet test
This runs the project’s tests through the configured .NET test tooling. If you want a subset by category, pass NUnit’s selection expression after the -- separator:
dotnet test -- NUnit.Where="cat == Unit || cat == Integration"
The separator passes the argument to the test host, while NUnit.Where supplies NUnit’s own selection expression. Category names are case-sensitive. Mark tests with categories such as Unit or Integration using NUnit’s Category attribute. Check that your installed runner and adapter support the filter syntax you use; NUnit’s Test Selection Language documents supported expressions.
Rank #3
Select tests in Visual Studio Test Explorer
- Build the solution so the NUnit adapter can discover tests.
- Open Test Explorer and wait for discovery to finish.
- Choose Run All to execute all discovered tests, or select several entries and run the selection from the context menu.
Parameterized cases appear as separate entries, so you can run one case or a selected group. See the adapter’s Usage documentation for its Visual Studio workflow.
Use the NUnit console runner when applicable
If you run the NUnit console runner against a test assembly, its selection language uses --where:
Rank #4
nunit3-console MyTests.dll --where "cat == Unit || cat == Integration"
This is the console runner’s syntax; do not assume it is interchangeable with another runner’s filtering options.
Discovery, case order, and independence
NUnit discovers parameterized invocations as separate tests, which makes them individually visible and selectable. Do not use repeated attribute order as a way to control execution order: discovery and execution order may differ. A single [TestCaseSource] preserves the order returned by that source, but combining multiple data-providing attributes can leave ordering undefined.
Best Value
- Keep cases independent so each can run alone or in a different order.
- Do not make one case depend on data or side effects left by another.
- If a real workflow requires sequencing, express that dependency explicitly rather than relying on discovery order.
Troubleshoot missing or unexpectedly selected cases
No parameterized cases appear
- Build the test project and allow the adapter to discover tests; in Visual Studio, discovery follows a build.
- Confirm the method has the NUnit parameterized-test attribute and that the project’s test tooling recognizes NUnit.
A case fails before the assertion
- Compare the argument count and types with the test method’s parameters.
- For
[TestCaseSource], verify the source returns enumerable argument sets compatible with the method and that the source member is static.
The filter runs no tests
- Check category spelling and capitalization; category names are case-sensitive.
- Use the filter syntax for the runner in use:
NUnit.Whereafter--withdotnet test, or--wherewith the NUnit console runner. - Confirm that the categories are assigned to the tests and that the installed adapter/runner supports the requested selection behavior.
Tests behave differently between runs
Look for hidden ordering dependencies or shared mutable state. Repeated [TestCase] attributes do not establish a reliable execution sequence.
Version scope
The NUnit documentation introduction covers NUnit 3.0 and higher. Older framework or adapter versions may differ, so verify feature and filter support against the versions installed in your project (NUnit Documentation).
Or skip the browser setup
If the task is capturing website screenshots for test fixtures, ScreenshotNeo can return a screenshot or PDF from one GET request. For example, save a WebP capture of a test URL:
Quick Recap
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify page verdict and billing status in headers. Its MCP server offers screenshot and PDF tools to AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Visit ScreenshotNeo for details, or sign up free.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




