Julia library for functional testing.
Author MechanicalRabbit
9 Stars
Updated Last
1 Year Ago
Started In
October 2017


NarrativeTest is 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.

Build Status Code Coverage Status Open Issues Documentation MIT License

Quick Start

Install the package using the Julia package manager:

julia> using Pkg
julia> Pkg.add("NarrativeTest")

Add NarrativeTest to your package as a test-specific dependency. Then create the following test/runtests.jl:

using NarrativeTest

If you are already relying on the standard Test library, you can add NarrativeTest as a nested test set:

using Test, NarrativeTest

@testset "MyPackage" begin

Write the test suite in Markdown and save it in the test directory. Place the test code in Markdown code blocks, and use comments #-> … and #=> … =# to indicate the expected output. For example:

# Sample test suite

Verify that the expression evaluates to the expected value:

    6(3+4)          #-> 42

Check if the code produces the expected output:

    print("Hello ")
    #-> Hello World!

Abbreviate the output with ellipsis:

    #-> ['a', 'b', …, 'z']

    26-element Array{Char,1}:

To test your package, run:

$ julia ./test/runtests.jl

For more information, see the Documentation.