You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to support wrapper functions which can be called around tests and optionally around each step. This could be used similar to clojure.test fixtures, but we don't really need to do common setup/teardown since greenlight already has facilities for that. Instead, we want to use this to add observability aspects to the tests to integrate them with tracing tools like honeycomb.
The text was updated successfully, but these errors were encountered:
robhanlon22
added a commit
to robhanlon22/greenlight
that referenced
this issue
Jun 9, 2022
Resolvesamperity#52.
This is a first pass for this feature so design input is requested.
Initial decisions:
- Use `use-fixtures` from `clojure.test` for fixture functions that
apply to all of the tests in a namespace. Note that this does not
support `:once` fixtures as of yet because the runner does not run all
tests in a namespace as a group that can be `:once`d. This will
require a change to `greenlight.runner`.
- Add `::test/each` as an option to the `deftest` attribute map. This
needs to be a collection of fixture functions. This could not quite be
expressed via the `use-fixtures` method because it would unilaterally
apply a fixture function to all steps in all tests in a namespace.
This could be an additional feature as well.
Open questions:
- Are functions expressive enough, or should this introduce a new
namespace that allows for composable definitions of fixtures in the
way that steps are composable? Something like `deffixture`, a
greenlight-specific `use-fixture` for top-level, and then fixture
configuration at the test/step level.
- Should context be passed into the fixture functions, and should it be
modifiable by the fixture functions? e.g., should downstream steps see
the changed context and should the test output contain that changed
context. This gets a bit sticky and pushes on the `deffixture` idea,
in that greenlight tries to be explicit about its data dependencies
and outputs, but with fixtures that can take/update context, declaring
data dependencies gets a bit hairier. I can imagine that `deffixture`
would _also_ declare inputs and outputs, which could then get merged
into the step inputs/outputs. Depends on how complex this needs to be.
It would be great to support wrapper functions which can be called around tests and optionally around each step. This could be used similar to
clojure.test
fixtures, but we don't really need to do common setup/teardown since greenlight already has facilities for that. Instead, we want to use this to add observability aspects to the tests to integrate them with tracing tools like honeycomb.The text was updated successfully, but these errors were encountered: