testing

Testing tools, testing philosophy & methodology...
2016-03-18T13:17:20.000006Z

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?

donaldball 2016-03-18T13:55:56.000008Z

You might enjoy using the generators from test.check

2016-03-18T13:58:19.000009Z

@donaldball: 👍

2016-03-18T14:19:27.000011Z

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

2016-03-18T14:26:26.000012Z

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

donaldball 2016-03-18T14:40:01.000013Z

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.

donaldball 2016-03-18T14:41:50.000014Z

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.

2016-03-18T14:42:26.000015Z

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

2016-03-18T14:44:17.000016Z

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

2016-03-18T14:45:05.000017Z

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

2016-03-18T14:45:34.000018Z

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

2016-03-18T14:45:48.000019Z

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