Phoenix command to generate only tests

I have a Phoenix project where I generated a few schemas. This schemas has been updated a few times and tests generated at first are not up to date anymore (missing fields, mainly).

My question is, what is the most efficient way to updates this tests? Is there a command to generate new tests with “current schema” (phx.gen.test ...) or I have to do it manually ?

1 Like

There is no such thing for few reasons. One of them is that until recently automatic manipulation of Elixir code was at least hard. Another thing is that it is hard for such tool to know what exactly you expect of such update.


You might use reflection to avoid missing fields…


… as explained in the book Testing Elixir