Fork me on GitHub
#testing
<
2016-03-18
>
thiagofm13:03:20

Hello everyone. I kinda miss having factories(as factory girl in Ruby) in clojure, I didn't even have to really write in the database and this felt like an advantage, how would you approach that in clojure?

donaldball13:03:56

You might enjoy using the generators from test.check

lmergen14:03:27

thiagofm: personally, i don't think mocking actual services is a very good idea, since you might be missing some important integration tests

thiagofm14:03:26

lmergen: I'm reading articles that support your point, but in the end I think it's really about tradeoffs, it makes things a bit easier to write

donaldball14:03:01

When working with services, I prefer to write a protocol, write a impl that hits the service, and an integration test that actually interacts with the service. For other tests, I’ll reify an impl that provides the behavior I need to exercise the conditions about which I care.

donaldball14:03:50

The utility of this approach is bounded by the complexity of system’s interaction with the service tho. Works great for a key-value store, not so well for a relational database unless only used in narrow ways.

thiagofm14:03:26

@donaldball: do you anything explaining this approach in detail? Sounds good

lmergen14:03:17

i actually create ad-hoc databases in my test's fixtures

lmergen14:03:05

it's a tradeoff, and i can definitely see pros and cons for both sides

lmergen14:03:34

but imho, if you're not testing integrations in your lein test, you're simply moving that problem to be tested in a later phase, which you will probably have to automate anyway

lmergen14:03:48

so it's best to just automate it as early as possible