Docs improvement: Testing with references to DataCase & DBConnection.OwnershipError
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
AI Policy
- [x] I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.
Is your feature request related to a problem? Please describe.
See this discussion for full context.
While getting a test harness up and running in a new Ash project, I ran into a few hiccups. I think some enhanced documentation would be well worth the investment.
I went back to look at the Ash Test Resources how-to-guide. It’s simplified (ETS) but, only shows how to use ExUnit.Case:
defmodule ActionInvocationTest do
use ExUnit.Case
...
And then there’s the section in Ash Testing, which talks about about turning off async? during testing, which is helpful information but... lacked a bit of context (e.g., when does it really matter, as I was using Postgres I actually did not want to turn it off).
The issue I ran into was, specifically, that most (all?) of the examples used ETS and ExUnit.Case. Nowhere have I found mention of using DataCase. It may be in there, and for someone that uses Ecto a lot, it may be obvious – but it’s not on those two central documents about testing. Might make sense to add it?
In my case, ultimately realizing I should be using DataCase led to instant fixes:
- Failing tests started passing (
DBConnection.OwnershipErrorwent away, this was hard to track down). - My ExUnit driven
doctestsstarted working just fine.
Describe the solution you'd like
Would be great to:
- Update docs with examples / highlights on use of
DataCase. - Include relevant references to Ecto sources.
- Mention that not using
DataCasemay likely run you intoDBConnection.OwnershipErrorerrors cascading all over the place. And break anydoctests.
Describe alternatives you've considered
No response
Additional context
No response