Reputation: 407
How can we pre-load data in test database for integration testing, like in Ruby-on-Rails we have fixtures for that. Is there any good documentation for writing test cases in Phoenix?
Upvotes: 6
Views: 962
Reputation: 54684
For integration tests you may want to take a look at Hound, which is something like Capybara for Elixir. They have some nice examples to get you started.
In Phoenix there is no standard way of loading fixtures like in Rails as far as I know. My personal opinion is that it is better to just have a minimal setup for each test case, instead of complicated global fixtures. It makes it much easier to see what you are actually testing, and which fixtures are really relevant to the current test case. I would say it is better to spend your time creating some helpers that will allow you to easily create records for testing. You might also find the Blacksmith and Faker projects useful for creating test data.
Upvotes: 6