Sharing Phoenix Test Code

I have a bunch of tests which have duplicate code.

Does anyone have any tips for reducing dupe code and sharing?

Esp when importing functions which use the convenience functionality provided by ‘Conncase’.

Perhaps it’s just Cortex, but my functions fail (cannot find shared functions “function is undefined”) when iex initially loads up, and then pass after retesting…


oh, and Phoenix itself gives this warning,

module Xoxo.ConnCase is not loaded and could not be found

for the testing utils file. The ‘use’ statement does seem to be necessary for the tests to run


1 Like

Can you post some code? What you tried, what you expect and what you get?



is a macro, which added some complexity when I pulled it out of the test file, and into a shared library.

So I used, this function instead:


which I can import from anywhere, with no assumptions required…

1 Like