Skip to content

[Feature]: Focus tests #4584

@agross

Description

@agross

Problem Statement

Hello, thank you for creating TUnit! I would love to see something along the lines of "focused tests" to easily limit the test run to classes or test methods without having to resort to filters.

Proposed Solution

[Focus]
public class RunsAll {
  [Test] ...
}


public class RunsSome {
  [Test] public void Skipped() {}
  [FTest] public void Runs() {}
  [Focus, Test] public void RunsToo() {}
}

Alternatives Considered

dotnet run --treenode-filter /*/*/*/*[Category=Focus]

Maybe? I find this too fiddly. I would have to read the docs every time I use these.

With [Focus] the above becomes dotnet run.

Feature Category

Test Discovery / Attributes

How important is this feature to you?

Nice to have - would improve my experience

Additional Context

I've been used to this since I had a look at rspec (a Ruby test framework).

RSpec also provides aliases – fit, fdescribe and fcontext – as a shorthand for it, describe and context with :focus metadata, making it easy to temporarily focus an example or group by prefixing an f.

Source

Contribution

  • I'm willing to submit a pull request for this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions