# \[ANN\] TestPicker - Interactive tool for testing based on fzf and bat

**URL:** <https://discourse.julialang.org/t/ann-testpicker-interactive-tool-for-testing-based-on-fzf-and-bat/128273>\
**Category:** Package Announcements\
**Tags:** package, testing, repl\
**Created:** [April 21, 2025, 8:21pm UTC](https://discourse.julialang.org/t/ann-testpicker-interactive-tool-for-testing-based-on-fzf-and-bat/128273 "2025-04-21T20:21:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![theogf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/theogf/32/1987_2.png) [@theogf](https://discourse.julialang.org/u/theogf)\
**Post date:** [April 21, 2025, 8:21pm UTC](https://discourse.julialang.org/t/ann-testpicker-interactive-tool-for-testing-based-on-fzf-and-bat/128273/1 "2025-04-21T20:21:09Z")

</div>

We all know testing does not necessarily has the best support in Julia. And if there are great frameworks like [ReTest.jl](https://github.com/JuliaTesting/ReTest.jl) or [TestItemRunner.jl](https://github.com/julia-vscode/TestItemRunner.jl) to mention these only, they still rely on replacing the traditional `Test.jl` framework.

`TestPicker.jl` does not try to achieve anything new but to make running tests, especially in large repositories a bit easier.

A demo is worth a thousand characters so here is one!

[![asciicast](https://asciinema.org/a/716546.svg)](https://asciinema.org/a/716546)

The main features TestPicker brings are:

- Running all tests with the right test environment (reusing `TestEnv.jl`).
- Tests are run in a module and do not affect the `Main` environment.
- Ability to run single testsets, even nested ones by fetching the right preamble from the file.
- Selection of one or multiple testfile/testset using `fzf` for an interactive experience associated with a highlighted preview of the content using `bat`
- Everything embedded in a repl mode (activated with `!`). I am aware that this potentially collide with some code, I hope to find a better solution in the future.
- Quick shortcut `test> -` to repeat the last set of tests
- Preview of failed tests using `fzf` again with a quick preview on the stack traces/failed test information.
- Preview of stack traces with source preview of the selected trace.

One main constraint of the tool is that test files should be self-contained (which I believe is a better practice), i.e. each file should contain all the `using ...` statements or `include("test-tooling.jl")` it needs.

Give it a try and please report any issue you face! 🤗

---

<div class="post-metadata">

**Author:** ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Post date:** [April 21, 2025, 8:35pm UTC](https://discourse.julialang.org/t/ann-testpicker-interactive-tool-for-testing-based-on-fzf-and-bat/128273/2 "2025-04-21T20:35:53Z")

</div>

Yup, this is going into my global environment. This looks super. Thanks for sharing and the creation @theogf !

---

<div class="post-metadata">

**Author:** ![Krastanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/krastanov/32/6817_2.png) [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Post date:** [May 9, 2025, 1:34am UTC](https://discourse.julialang.org/t/ann-testpicker-interactive-tool-for-testing-based-on-fzf-and-bat/128273/3 "2025-05-09T01:34:10Z")

</div>

Is this compatible with using `TestItems`?

---

<div class="post-metadata">

**Author:** ![theogf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/theogf/32/1987_2.png) [@theogf](https://discourse.julialang.org/u/theogf)\
**Post date:** [May 9, 2025, 4:01pm UTC](https://discourse.julialang.org/t/ann-testpicker-interactive-tool-for-testing-based-on-fzf-and-bat/128273/4 "2025-05-09T16:01:41Z")

</div>

Not per se. If a `@testitem` macro is used and `using TestItems` is present in the file, running a test file would work.  
However `@testitem` blocks will not be identified directly (as for `@testset`). It should actually be possible to do it so I might give it a try.

---

<div class="post-metadata">

**Author:** ![Krastanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/krastanov/32/6817_2.png) [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Post date:** [May 9, 2025, 5:25pm UTC](https://discourse.julialang.org/t/ann-testpicker-interactive-tool-for-testing-based-on-fzf-and-bat/128273/5 "2025-05-09T17:25:19Z")

</div>

Maybe more generally there can be a configuration option to manually add to the preamble or have a default `tests/testpicker_preamble.jl` that is always loaded if found?

---

<div class="post-metadata">

**Author:** ![JoshuaLampert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joshualampert/32/205964_2.png) [@JoshuaLampert](https://discourse.julialang.org/u/JoshuaLampert)\
**Post date:** [May 9, 2025, 6:50pm UTC](https://discourse.julialang.org/t/ann-testpicker-interactive-tool-for-testing-based-on-fzf-and-bat/128273/6 "2025-05-09T18:50:47Z")

</div>

I actually tried that already because I wanted to try out TestPicker.jl in a project where I use TestItems.jl. Turned out that also checking for `Symbol(@testitem)` [here](https://github.com/theogf/TestPicker.jl/blob/83f92c13e1d416a869e5362c74a48b54e60b9f5b/src/testset.jl#L4) was enough to make it work. Would be cool if that would be directly in the package. It would even be better if one could add other symbols (or search for patterns like `testset` as substring) that are counted as testset because, e.g., in Trixi.jl we use a custom [`@trixi_testset`](https://github.com/trixi-framework/Trixi.jl/blob/bb5b65f52572f8a66bca154dc8b1be373d1b8022/test/test_trixi.jl#L198).

---

<div class="post-metadata">

**Author:** ![theogf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/theogf/32/1987_2.png) [@theogf](https://discourse.julialang.org/u/theogf)\
**Post date:** [May 13, 2025, 9:44pm UTC](https://discourse.julialang.org/t/ann-testpicker-interactive-tool-for-testing-based-on-fzf-and-bat/128273/7 "2025-05-13T21:44:36Z")

</div>

I would be happy to let users define their own symbols to be detected but I wonder how to properly capture those.  
For now I will do the dumb thing and just `ENV` but we can get something fancier and more robust eventually.

> e.g., in [Trixi.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/Trixi) we use a custom [`@trixi_testset`](https://github.com/trixi-framework/Trixi.jl/blob/bb5b65f52572f8a66bca154dc8b1be373d1b8022/test/test_trixi.jl#L198).

Nice package btw!

---

<div class="post-metadata">

**Author:** ![JoshuaLampert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joshualampert/32/205964_2.png) [@JoshuaLampert](https://discourse.julialang.org/u/JoshuaLampert)\
**Post date:** [May 14, 2025, 8:31am UTC](https://discourse.julialang.org/t/ann-testpicker-interactive-tool-for-testing-based-on-fzf-and-bat/128273/8 "2025-05-14T08:31:20Z")

</div>

Thanks! The `ENV` solution is already quite nice.
