# Test data as Artifact

**URL:** <https://discourse.julialang.org/t/test-data-as-artifact/136239>\
**Category:** General Usage\
**Tags:** testing, artifacts\
**Created:** [March 17, 2026, 4:32pm UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239 "2026-03-17T16:32:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [March 17, 2026, 4:32pm UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239/1 "2026-03-17T16:32:21Z")

</div>

My package’s tests require ~20 MB of data. Currently, this data is regenerated on every test run. I’d like to generate it once (e.g., per release) and fetch it at test time instead.

The Julia Artifacts framework seems like the right fit for this. Is there a guide for this workflow? Specifically: starting from a package with separate test-data-generation code and test code, how do I set things up so that `Pkg.test()` downloads pre-generated test data via Artifacts and runs the tests against it?

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [March 17, 2026, 4:56pm UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239/2 "2026-03-17T16:56:17Z")

</div>

Create the `Artifacts.toml` _somehow_ (if you don’t know, I recommend using ArtifactUtils.jl, you probably want to make the artifact lazy), then in the tests refer to [the artifact name with `artifact"..."`](https://pkgdocs.julialang.org/v1/artifacts/#Basic-Usage) and it’ll be downloaded automatically on demand.

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [March 17, 2026, 5:00pm UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239/3 "2026-03-17T17:00:24Z")

</div>

In TestImages.jl they (you?) baked in the artifact asset into the release of that package, which is a nice way to link the assets with the code _per release_. Is there a guide for that?

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [March 17, 2026, 5:09pm UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239/4 "2026-03-17T17:09:58Z")

</div>

A guide for what? For upoading a file to a release?

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [March 17, 2026, 5:14pm UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239/5 "2026-03-17T17:14:42Z")

</div>

Eh, yeah, basically. Like a step by step guide / blog for how to publish a package that uses artifacts to supply itself with its own test data. I realize as I’m typing this that this does not exist, but I’ll go try this out and see if I can make one.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [March 17, 2026, 5:19pm UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239/6 "2026-03-17T17:19:50Z")

</div>

Method 1 of [Creating GitHub Releases with Binary Artifacts: A Complete Guide](https://zerotohero.dev/inbox/github-releases/)? It’s really two clicks on the web UI, not even GitHub has documentation for this apparently.

---

<div class="post-metadata">

**Author:** ![guilhermebodin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guilhermebodin/32/6982_2.png) [@guilhermebodin](https://discourse.julialang.org/u/guilhermebodin)\
**Post date:** [March 18, 2026, 2:16am UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239/7 "2026-03-18T02:16:02Z")

</div>

A little annoying side effect is that if someone compiles the package with PackageCompiler it will get your artifacts in the bundle.

```julia-auto
PackageCompiler: bundled artifacts:
  ├── Bzip2_jll - 2.136 MiB
  ├── CSV
  │ └── testfiles - 27.700 MiB
  ├── HiGHS_jll - 12.870 MiB
  ├── OpenBLAS32_jll - 44.883 MiB
  ├── OpenSpecFun_jll - 728.003 KiB

```

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [March 18, 2026, 5:47am UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239/8 "2026-03-18T05:47:58Z")

</div>

Even if it’s lazy?

---

<div class="post-metadata">

**Author:** ![nhz2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nhz2/32/44428_2.png) [@nhz2](https://discourse.julialang.org/u/nhz2)\
**Post date:** [March 18, 2026, 12:57pm UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239/9 "2026-03-18T12:57:32Z")

</div>

Does putting the `Artifacts.toml` in the test directory solve this? In CSV.jl it looks like it is in the main directory.

---

<div class="post-metadata">

**Author:** ![guilhermebodin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guilhermebodin/32/6982_2.png) [@guilhermebodin](https://discourse.julialang.org/u/guilhermebodin)\
**Post date:** [March 19, 2026, 3:30pm UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239/10 "2026-03-19T15:30:00Z")

</div>

@yakir12 I usually opt to add the lazy artifacts in compilation

@nhz2 Good point, never thought of it. It might work.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [March 19, 2026, 4:17pm UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239/11 "2026-03-19T16:17:24Z")

</div>

Also:

> <https://github.com/JuliaPackaging/ArtifactUtils.jl/pull/28>
>
> This is a continuation of #22 .
> 
> I have updated the code to use \`gh release cr…eate\` and \`gh release upload\`, and has some unit tests.
> 
> The way we get the repo name has change slightly, and instead uses whatever is set default for \`gh\`, i.e., \`gh repo set-default owner/repo\`.
> 
> These unit tests \*\*will\*\* pollute the releases of this repo, so I am happy to change the test strategy if preferred by the maintainers.
> 
> Thanks :)

---

<div class="post-metadata">

**Author:** ![nhz2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nhz2/32/44428_2.png) [@nhz2](https://discourse.julialang.org/u/nhz2)\
**Post date:** [April 7, 2026, 7:02pm UTC](https://discourse.julialang.org/t/test-data-as-artifact/136239/12 "2026-04-07T19:02:46Z")

</div>

As a follow up, if you move the Artifacts.toml to inside the test directory you may have to run:

```julia
Pkg.Artifacts.ensure_artifact_installed("<NAME OF ARTIFACT>", joinpath(@ __DIR__ , "Artifacts.toml"))

```

Before running the tests.

> <https://github.com/JuliaIO/ZipArchives.jl/blob/5f016b70585c8d5f8dd5751b5a2eed8624702884/test/test_reader.jl#L250-L251>
