How to test phoenix controller?

Mix 1.8.1 (compiled with Erlang/OTP 21)
Phoenix v1.3.4

I made an phoenix app (frontend) as the (View Controller) and separate another phoenix app that only has API (Model).

Any recommendation how to test a phoenix controller on rendering and redirections?

Assert the status code?

When you say separate, how separate? Are they both part of the same umbrella project or are you making these requests over HTTP?

Hello thank you for the response, I’m making requests over HTTP, Frontend(phoenix repo) then calling API(another phoenix repo)



Programming Phoenix 1.4 has a Testing MVC - Integration Tests for Views and Controllers section

Though of course none of that addresses testing the frontend controllers that use an http-API.

1 Like

If you’re doing it over HTTP the thing you’re going to lose vs doing it all in one application is the out of the box per test case database isolation. However if you port you’ll get that too.

1 Like