How to run only one chosen unittest
madwebness
madwebness at noreply.noreply
Tue Dec 16 10:40:34 UTC 2025
Been banging my head with ChaptGPT on this one, it just couldn't
figure it out how to run only a particular unittest with `dub
test`, so I have to ask.
I only use standard `unittest {}`, no libraries. It's quite often
that I just want to run one single unit test - or, at the very
least, only tests in one particular module (if one test isn't
possible).
To give you an idea from other languages, Iin Go + Ginkgo this
would be:
```
It("should run this one", Label("onlythis"), func() { ...
```
in Ruby / rspec it'd be something like:
```
rspec path/to/test.rb:25
```
where 25 is the line number of unit test starts.
I understand that even in Go or Ruby - those are the testing
libraries in my examples, not something native to the language,
but I was still wondering if something like that is possible in
D. I wouldn't even mind writing some short Bash script that would
temporarily manipulate `dub.json` or something like that - to
achieve what I want. The number of unittests in my codebase is
getting larger and I feel it might be the right time to address
this problem.
Would appreciate some any ideas here.
More information about the Digitalmars-d-learn
mailing list