Providing context to @test macro

You can put @testset on the loop directly and interpolate the loop variable into the description string:

@testset "Sample test $i" for i = 1:10000
    @test foobar(rand(1:1000)) == false
end

Though I’d precompute the random numbers and use the resulting index in the description string as well, since that’s what actually makes the test fail. Maybe like for i in rand(1:10000, 1000).