Usability improvements in TestItemRunner.@testmodule

Ken_Williams
Fri, 19 Sep 2025 14:42:25 +0000
General Usage

There are a couple of usability improvements I’d love to see in the @testmodule functionality from TestItemRunner:

1. The ability to load a testing module from the REPL, so I could do something like

TestEnv.activate()
load_test_module("Foo")  # finds '@testmodule Foo' definition and loads it
...now run interactive code that uses the testing modules

The workaround I’m doing for #1 right now is to find the code & paste it into the REPL - not great, and it’s not always straightforwardly pasteable.

2. Export names from a test module:

@testmodule Bar begin
    do_stuff(a, b) = a * b
    export do_stuff
end

The workaround for #2 is to do stuff like this in my unit tests:

@testitem "My Test" setup = [Bar] begin
    do_stuff = Bar.do_stuff
    ...
end

I’ve thought about taking a crack at these myself, probably with a heavy assist from Claude or Copilot or something, but wanted to get anyone else’s opinions on feasibility, or approach, or thoughts about different objectives, etc. before starting that myself. I would also be happy to see anyone else accomplish them who knows what they’re doing in this code better than I do. =)

3 posts - 1 participant