I’m happy to announce the first release of TidyTest.jl, a package for test execution with auto discovery and a neater test summary. It is using ProgressMeter.jl to report progress as the tests are completed.
Usage
For the simplest use case, write the following lines in your runtests.jl
file:
using TidyTest
@run_tests
Add TidyTest.jl
to the dependencies of your test:
julia> using Pkg; pkg"activate test; add TidyTest"
And then execute your tests:
$ julia --project -e "using Pkg; Pkg.test()"
For example:
The @run_tests
macro automatically discovers all Julia source files in the directory of runtests.jl
, and includes all of them. The entire block is wrapped in a single toplevel @testset
using the custom test set type SpinnerTestSet
. Test progress is reported using ProgressMeter.jl, continuously updating the status as tests are completed. If some tests fail (or throw an error), the issues are reported as they happen, and a detailed test summary is printed upon completion, using the default test reporting.
Test filtering
The macro facilitates running tests selectively. Every command line argument is used as a pattern, and only those tests are run which contain any of the arguments as a substring. The search uses smart case matching: if any of the patterns contains at least one capital letter, then matching is case-sensitive,
otherwise its case-insensitive. To pass command line arguments to Pkg.test()
, the test_args
keyword argument must be used:
$ alias jlt='julia --project -e "using Pkg; Pkg.test(test_args=ARGS)"'
$ jlt some tests
# ...runs test files which have "some" or "test" occurring in their names
Alternatively, one can filter tests by passing a filters
keyword argument to the @run_tests
macro, with a list of strings:
@run_tests filters=["some", "tests"]