test-check

dangercoder 2019-01-27T13:16:52.021800Z

Do you guys use any external stateful things like a database (Redis) or do you create simulators for all of it? Lets say you want to create property based tests for a sequence of function calls that uses Redis.

dangercoder 2019-01-27T13:18:01.021900Z

I was thinking of just having a redis-test-instance and then I will "Clean" it after all tests are done running.

2019-01-27T13:43:58.022300Z

yeah you'd want to effectively reset the database as part of your trial

2019-01-27T13:44:13.022700Z

I've certainly done that before you can find bugs in your database that way 🙂

2019-01-27T13:44:55.023400Z

but having to reset something in a different process can definitely lead to fairly slow tests, so you have to have some tolerance for that

2019-01-27T16:58:13.026600Z

a year (maybe two?) ago we switched out the redis library we used at work, and I took all the operations we did using an old redis library and defined them as a protocol, then implemented that protocol on a concurrent hashmap and on the new redis library, then I wrote the thunderdome, which would take a generated list of redis operations and two things that satisfied the redis protocol and run those operations against them comparing the results.

2019-01-27T17:00:09.026800Z

https://github.com/advancedtelematic/quickcheck-state-machine is super interesting

2019-01-27T17:39:56.027200Z

@hiredman did you find bugs in redis?

2019-01-27T18:03:41.030400Z

I did not, I wasn't really exercising redis, the kind of api layer I pulled out, we aren't (weren't?) using redis all that much, but I wanted to make sure the operations behaved the same when moving from a higher level library (lots of built in serialization magic) to a lower level library (doing all the serialization ourselves). I think the protocol I ended up defining to encapsulate our redis use was maybe 4 functions