# Concise test output from PPX\_expect?

**URL:** <https://discuss.ocaml.org/t/concise-test-output-from-ppx-expect/15252>\
**Category:** Learning\
**Created:** [September 5, 2024, 5:56pm UTC](https://discuss.ocaml.org/t/concise-test-output-from-ppx-expect/15252 "2024-09-05T17:56:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fay](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/fay/32/5591_2.png) [@Fay](https://discuss.ocaml.org/u/Fay)\
**Post date:** [September 5, 2024, 5:56pm UTC](https://discuss.ocaml.org/t/concise-test-output-from-ppx-expect/15252/1 "2024-09-05T17:56:41Z")

</div>

I just started working on a pretty large codebase which uses ppx\_expect for testing, all of which is pretty new to me. What I really need is a higher level idea of what is and isn’t working, but the current test output is roughly 4k lines with an overwhelming, difficult to parse amount of information.

I want something more like a name + pass/fail for each test, is that possible with ppx\_expect? Should I use a custom test runner or is my only choice using like something like awk/sed to reduce the output to just the info I want?

---

<div class="post-metadata">

**Author:** ![shonfeder](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/shonfeder/32/424_2.png) [@shonfeder](https://discuss.ocaml.org/u/shonfeder)\
**Post date:** [September 5, 2024, 9:28pm UTC](https://discuss.ocaml.org/t/concise-test-output-from-ppx-expect/15252/2 "2024-09-05T21:28:11Z")

</div>

You can do small, named expect tests. This is how I usually see it used (and what is given as an example here [GitHub - janestreet/ppx\_expect: Cram like framework for OCaml](https://github.com/janestreet/ppx_expect)).

Am I misunderstanding your question? Or possible you just happen to be looking at a gnarly test case? If you can share an example that could help clarify!

---

<div class="post-metadata">

**Author:** ![shonfeder](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/shonfeder/32/424_2.png) [@shonfeder](https://discuss.ocaml.org/u/shonfeder)\
**Post date:** [September 5, 2024, 9:29pm UTC](https://discuss.ocaml.org/t/concise-test-output-from-ppx-expect/15252/3 "2024-09-05T21:29:13Z")

</div>

Oh sorry, I think I understand now. You don’t want to see the diff for each failing test but just whether it passed or failed?

---

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [September 5, 2024, 10:19pm UTC](https://discuss.ocaml.org/t/concise-test-output-from-ppx-expect/15252/4 "2024-09-05T22:19:10Z")

</div>

It might be useful to paste an example of problematic behaviour (or maybe make it available on a GitHub repo somewhere) – just so we can see what you mean. Obviously, there’s the idea of “try to reduce the output bulkiness”. But I’m sure you’ve already gone down that path.

I personally really like `mdx`: I find it to be excellent for expect-test-like stuff, and have used it to wrote both tests and documentation, viz. the README for [GitHub - camlp5/pa\_ppx\_regexp: Camlp5-compatible PPX rewriters for Perl-ish idiomatic regexps](https://github.com/camlp5/pa_ppx_regexp)

---

<div class="post-metadata">

**Author:** ![yawaramin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yawaramin/32/3384_2.png) [@yawaramin](https://discuss.ocaml.org/u/yawaramin)\
**Post date:** [September 6, 2024, 4:21am UTC](https://discuss.ocaml.org/t/concise-test-output-from-ppx-expect/15252/5 "2024-09-06T04:21:26Z")

</div>

I think that’s it. If you have a lot of tests and many of them failed, you have to trawl through the output to get a sense of all the failures and figure out what to fix first. If there was a ‘summary’ of all the failed tests at the bottom it would be easier to rerun specific ones and fix them one at a time. I often do this in Scala.

---

<div class="post-metadata">

**Author:** ![shonfeder](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/shonfeder/32/424_2.png) [@shonfeder](https://discuss.ocaml.org/u/shonfeder)\
**Post date:** [September 6, 2024, 5:54pm UTC](https://discuss.ocaml.org/t/concise-test-output-from-ppx-expect/15252/6 "2024-09-06T17:54:54Z")

</div>

Makes sense. I don’t know how to get ppx expect to provide such a summary, but that could be a nice feature request or addition.
