# How do I know which files, or which tests, \`zig build test\` covers?

**URL:** <https://ziggit.dev/t/how-do-i-know-which-files-or-which-tests-zig-build-test-covers/6672>\
**Category:** Help\
**Tags:** build-system, testing\
**Created:** [November 4, 2024, 2:58am UTC](https://ziggit.dev/t/how-do-i-know-which-files-or-which-tests-zig-build-test-covers/6672 "2024-11-04T02:58:41Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![jeffective](https://ziggit.dev/user_avatar/ziggit.dev/jeffective/32/3116_2.png) [@jeffective](https://ziggit.dev/u/jeffective)\
**Post date:** [November 5, 2024, 3:26am UTC](https://ziggit.dev/t/how-do-i-know-which-files-or-which-tests-zig-build-test-covers/6672/3 "2024-11-05T03:26:33Z")

</div>

related:

> [@Getting \`zig build test\` to find all the tests in my module](https://ziggit.dev/t/getting-zig-build-test-to-find-all-the-tests-in-my-module/6276):
>
> Edit: Changed title from “Should I put std.testing.refAllDecls(@This()); in all my files?” Ziggits docs suggest using test { std.testing.refAllDeclsRecursive(@This()); } in my root.zig But this is problematic when I declare a top-level declaration like so: pub const SyncM = packed struct(u64) { physical\_start\_address: u16, length: u16, /// control register control: esc.SyncManagerControlRegister, status: esc.SyncManagerActivateRegister, enable\_sync\_manager: Ena…

> [@Improving Test Runner API](https://ziggit.dev/t/improving-test-runner-api/5887):
>
> I think testing in zig should be easier. The issues I have could be summarized as: The test runner is just as lazy as the compiler. See [How do I get zig build to Run all the tests?](https://ziggit.dev/t/how-do-i-get-zig-build-to-run-all-the-tests/4434) This means I have to know the intricacies of conditional compilation / lazy compilation to even begin to reason about which tests are “detected”. The observabilty of tests is poor. Even with --summary all and --summary new it is still difficult for me to know what tests have ran. This has resulted in me consciousl…

> [@How do I get zig build to Run all the tests?](https://ziggit.dev/t/how-do-i-get-zig-build-to-run-all-the-tests/4434/4):
>
> I think the way to do this is using std.testing.refAllDecls() . Basically as long as you reference varint and any other module you want tested in your root.zig , you can use that function so that the semantic analyzer sees them: I had been using that, though, as you note, it only seems to be discovering public attributes, though that might be because i wasn’t using them. My concern with this is, as you state, refAllDecls has been declared to be a hack. I wasn’t sure if this “hack” had had a …

---

_[View the full topic](https://ziggit.dev/t/how-do-i-know-which-files-or-which-tests-zig-build-test-covers/6672)._
