Managing Application State in Elixir Tests

113
clicks
Managing Application State in Elixir Tests

Source: reddit.com

Type: Discussion

sectional343 has an application with a specific supervision hierarchy and encounters issues when running unit tests. By default, Elixir starts the entire application for tests and doesn't restart it between them, leading to flaky tests as one test's state affects subsequent tests. The author finds this behavior counterintuitive, as they expect a clean state for each test. They ask the community for advice on whether stopping and restarting the application manually in each test setup or using the `--no-start` flag is a correct solution or if their application architecture might be flawed.

© HashMerge 2024