Incorrect console output for nested @testset

I created nested @testsets with tests. In general, it is running correct for all tests, but console output is not same as I expected from following website. I tried it on Julia 1.5.2, 1.5.4, 1.6RC.

https://docs.julialang.org/en/v1/stdlib/Test/

Modified example from website:

using Test

@testset "1." begin
    @testset "1.1" begin
        @testset "Felines" begin
            @test true
        end
        @testset "1.2" begin
            @test true
        end
    end
    @testset "1.2" begin
        @test true
    end
end

Console output:

Test Summary: | Pass  Total
1.            |   3     3
Test.DefaultTestSet("1.", Any[Test.DefaultTestSet("1.1", Any[Test.DefaultTestSet("Felines", Any[], 1, false, false), Test.DefaultTestSet("1.2", Any[], 1, false, false)], 0, false, false), Test.DefaultTestSet("1.2", Any[], 1, false, false)], 0, false, false)

I’m expecting output like this:

Test Summary: | Pass  Total
1.            |   3     3
1.1           |   1     1
1.2           |   1     1
1.2           |   1     1
1 Like

This is expected. By default, you get the detailed summary only if there was a failure. On Julia 1.6, you can pass the verbose=true argument to the outer @testset macro to get the output you expected, i.e. @testset verbose=true "1." begin ...

1 Like

Thank you so much. Solved.

I have one more question. Option verbose=true is what I wanted to see test summary results. Behind this “Test Summary” is another part, some kind of array “Test.DefaultTestSet”. How can I hide this?

I assume you are talking of the return value of the @testset, which you can hide by inserting ; at the end of the expression (like for any other expression at the REPL).

1 Like

Thank you. Solved