Skip to content

jacobjmarks/xunit-environment-variable-isolation

Repository files navigation

xUnit Environment Variable Isolation

The following repository contains a subset of choice solutions discussed in the following blog post article:

Isolating Environment Variables in xUnit Tests | these are my thoughts

When testing systems that utilise environment variables at runtime, careful consideration needs to be given to the design of both the system, if governed, and the test suite to avoid unexpected and seemingly irreproducible runtime and assertion failures when these variables are used in parallel.

Read more

Contents

For simplicity and demonstration purposes, each example project below is self-contained; the projects each contain the system under test, the associated test suites, and no code is shared between them.

You will find any additional components which are required to support a given solution within a respective /Support folder.

Solution B: Serial Execution

Go to example

Solution C: Dependency Inversion

Go to example