A lightweight testing framework for Julia. Recursively finds your Julia test files and runs them, with some helpful setup/teardown functionality to DRY up your tests a little bit.
Install testfast from your Julia repl:
Pkg.clone("git://github.com/Veraticus/testfast.jl.git")
Then create the testfast.jl
file in your test/
directory. (This is your test helper -- it'll start the tests and you can put global setup/teardown istuff in it.) It doesn't need any more content than this:
using Testfast
Testfast.run!()
A testfast test file's name must end with test
and have the .jl
extension -- otherwise it won't be run by testfast. It should ideally contain a bunch of tests, defined using the @test
macro:
@test "this is the name of the test" begin
@assert 1 == 1
end
You can also define @before_all
, @setup
, @teardown
and/or @after_all
if you need to perform some common setup or cleanup for all your tests.
Run only once for each test file, before all tests are run.
Run before each test in the test file.
Run after each test in the test file.
Run only once for each test file, after all tests are run.
Once you've authored your tests, run them:
$ julia test/testfast.jl
..........
10 tests run.
10 passed, 0 failed in 0.0189 seconds.