I see two common patterns when it comes to testing larger packages.
runtests.jl (Coarse Style)
(this is often done with a loop over filenames but I’ll write it here in full)
using Base.Test @testset "compA" begin include(compA.jl) end @testset "compB" begin include(compB.jl) end
compA.jl and similarly compB.jl (Course Style)
using Base.Test #reuse this in the included file so can run standalone # Tests for foo @test foo(1)==7 @test foo(2)==9 @test foo(3)==16 # Tests for bar @test bar(1)==8 @test bar(2)==-8
(this is also often done with a loop over filenames but I’ll write it here in full)
using Base.Test include(compA.jl) include(compB.jl)
compA.jl and similarly compB.jl (Fine Style)
using Base.Test #reuse this in the included file so can run standalone @testset "foo" begin @test foo(1)==7 @test foo(2)==9 @test foo(3)==16 end @testset "bar" begin @test bar(1)==8 @test bar(2)==-8 end
Are there any pros or cons to combining them?
That is to say taking
runtest.jl from the coarse style, and
compB.jl from the fine style.
I know it is legal.
As I recall what happens when you do
julia runtest.jl, is that you only see the records for the outer most layer – that is the coarse
But it fully includes the total counts from the lower levels.
Seems like it is purely, since now if running a subset of the tests eg
julia compA.jl, we would also get a nice breakdown table; at the fine grained level.
But I’ve never seen this done in packages.
So perhaps I am wrong and it doesn’t work so good