[ANN] NarrativeTests.jl

I’d like to introduce NarrativeTests.jl, a Julia library for functional testing, which lets you write the test suite in the narrative form. It permits you to describe the behavior of software components in the Markdown format, and then extract, execute, and validate any embedded test code.

NarrativeTests.jl is essential in our development process. We use it not just to test edge cases, but also to generate supplemental documentation and, crucially, to validate the ergonomics of complicated programming interfaces. We hope others may find it useful too.

URL: https://github.com/rbt-lang/NarrativeTest.jl

Example: https://rbt-lang.org/NarrativeTest.jl/latest/test.html

7 Likes

I wonder if you’ve considered supporting doctest blocks?

I didn’t think it would be useful because doctests are already supported by Documenter.jl. However, I prefer output-in-comment syntax since it lets me write tests as well-formed Julia code. FWIW, Julia didn’t have to borrow doctest syntax from Python. In Python, doctests have to imitate an interactive session because there are no multi-line comments, but Julia doesn’t have this limitation.

EDIT: Or, perhaps, you mean extracting test code from docstrings? I haven’t considered it because I usually don’t add executable examples to docstrings, but it sounds like a useful feature.

well-formed Julia code

Yeah I can see how that would be useful.

extracting test code from docstrings?

This would be useful to me, at least.