# Multi-threaded testing

**URL:** <https://discourse.julialang.org/t/multi-threaded-testing/95372>\
**Category:** General Usage\
**Tags:** testing, parallel, multithreading\
**Created:** [March 1, 2023, 9:25am UTC](https://discourse.julialang.org/t/multi-threaded-testing/95372 "2023-03-01T09:25:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [March 1, 2023, 9:25am UTC](https://discourse.julialang.org/t/multi-threaded-testing/95372/1 "2023-03-01T09:25:24Z")

</div>

I want to use multithreading to speed up my test suite, but it seems to “hide” the tests from the test set. Any idea why?

```julia
julia> using Base.Threads

julia> using Test

julia> @testset "Sequential" begin
           for i in 1:10
               @test true
           end
       end;
Test Summary: | Pass Total Time
Sequential | 10 10 0.0s

julia> @testset "Parallel" begin
           @threads for i in 1:10
               @test true
           end
       end;
Test Summary: |Time
Parallel | None 0.1s

```

Related thread: [Run Pkg.test with several processors](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917)

Unrelated thread: [Test code with multi-threading](https://discourse.julialang.org/t/test-code-with-multi-threading/41754) (they want to test multithreaded code, not test code in a multithreaded way)

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [March 1, 2023, 1:27pm UTC](https://discourse.julialang.org/t/multi-threaded-testing/95372/2 "2023-03-01T13:27:01Z")

</div>

I haven’t tried it, but maybe [GitHub - RelationalAI-oss/XUnit.jl: XUnit.jl is a unit-testing framework for Julia.](https://github.com/RelationalAI-oss/XUnit.jl) could be helpful

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [March 1, 2023, 2:57pm UTC](https://discourse.julialang.org/t/multi-threaded-testing/95372/3 "2023-03-01T14:57:05Z")

</div>

The [test item](https://discourse.julialang.org/t/prerelease-of-new-testing-framework-and-test-run-ui-in-vs-code/86355) framework has support for parallel test execution. In VS Code you can enable it by setting `julia.numTestProcesses` to the number of processes you want to use. From the command line there is the _very_ experimental [GitHub - julia-vscode/TestItemRunner2.jl](https://github.com/julia-vscode/TestItemRunner2.jl) to run test items in parallel.
