# How to capture results from Pkg.test

**URL:** <https://discourse.julialang.org/t/how-to-capture-results-from-pkg-test/60214>\
**Category:** General Usage\
**Tags:** testing\
**Created:** [April 29, 2021, 2:34am UTC](https://discourse.julialang.org/t/how-to-capture-results-from-pkg-test/60214 "2021-04-29T02:34:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluesmoon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bluesmoon/32/327_2.png) [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)\
**Post date:** [April 29, 2021, 2:34am UTC](https://discourse.julialang.org/t/how-to-capture-results-from-pkg-test/60214/1 "2021-04-29T02:34:03Z")

</div>

When I test a package using `Pkg.test("PackageName")`, how do I capture the results in the calling process?

ie, something like `results = Pkg.test("PackageName")`

Is my only option to use a custom test set subtype? If this is my only option, are there examples of how I would access the results?

Thanks,  
Philip

---

<div class="post-metadata">

**Author:** ![adolgert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adolgert/32/20286_2.png) [@adolgert](https://discourse.julialang.org/u/adolgert)\
**Post date:** [April 29, 2021, 4:41pm UTC](https://discourse.julialang.org/t/how-to-capture-results-from-pkg-test/60214/2 "2021-04-29T16:41:10Z")

</div>

`Pkg.test()` won’t return to you a list of which packages failed and their error messages. It doesn’t because it’s setting up a clean environment for the tests, and they run inside it. One way to get test results is to use [GitHub - JuliaTesting/TestReports.jl: Making JUnit style XML reports for your julia tests](https://github.com/JuliaTesting/TestReports.jl). This will write an XML file you can parse with EzXML, as in this [example](https://github.com/adolgert/GatherShot.jl/blob/main/src/coverage_matrix.jl). `TestReports.jl` also demonstrates how to hook into the TestSet. You don’t need to make a subtype because the information is already there. I also found [GitHub - fjarri/Jute.jl: A Py.Test-like testing framework for Julia](https://github.com/fjarri/Jute.jl) illustrative, but both examples are lengthy. Maybe someone has a shorter example?
