# Plunit and individual test setup/cleanup

**URL:** <https://swi-prolog.discourse.group/t/plunit-and-individual-test-setup-cleanup/4853>\
**Category:** Tools\
**Tags:** how-to\
**Created:** [January 7, 2022, 11:38pm UTC](https://swi-prolog.discourse.group/t/plunit-and-individual-test-setup-cleanup/4853 "2022-01-07T23:38:29Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [January 8, 2022, 5:14pm UTC](https://swi-prolog.discourse.group/t/plunit-and-individual-test-setup-cleanup/4853/8 "2022-01-08T17:14:27Z")

</div>

> [@peter.ludemann](#):
>
> FWIW, other test frameworks I’ve used (in other languages) allow specifying both global setup/cleanup (done once for a set of tests) and every-test setup/cleanup – which is why I’m suggesting adding this to plunit.

Have you tried using a [wrapper](https://www.swi-prolog.org/pldoc/doc/_SWI_/library/prolog_wrap.pl)?

I remember originally [noting](https://swi-prolog.discourse.group/t/wrapping-predicates/668/21) this with wrappers but IIRC a Prolog wrapper can not pass stateful information from the `before` predicate to the `after` predicate. Never checked if that was allowed or not.

* * *

I also have to agree that this is often the case

> other test frameworks allow specifying both global setup/cleanup and every-test setup/cleanup

---

_[View the full topic](https://swi-prolog.discourse.group/t/plunit-and-individual-test-setup-cleanup/4853)._
