Fork me on GitHub
#off-topic
<
2022-11-12
>
skylize01:11:09

Looking for resources to learn to describe "properties" for property-based testing. Can't find anything much deeper than a sales-pitch, with the only meaningful example of a property being that a list reversed twice should be the same as it started.

hiredman01:11:37

There is also #C0JKW8K62, but not super active

hiredman01:11:57

https://youtu.be/zi0rHwfiX1Q is likely also good, but I don't recall if I've seen it

hiredman01:11:40

https://fsharpforfunandprofit.com/posts/property-based-testing-2/ may also be a good read, the dropbox testing in the first video would fall under what this series calls model based testing

skylize01:11:18

Thanks. Those look promising.

jumar05:11:06

Eric Normand’s course on property based testing is great

Drew Verlee14:11:04

A property is the set of all possible allowed values you want your function to be able to handle. So if you take a list of numbers you might have two properties, the first is how many numbers, the second might be what range. In the end, it's a tool for testing your expectations. That's how i think of it, i rarely find a use for property based testing simply because most things i do are very coupled and not useful reusable.

skylize02:11:37

Sharing is welcome 🙂

Sam Ritchie04:11:23

https://github.com/sicmutils/sicmutils/search?q=checking&amp;type= I use a ton in this library if you want some examples

🙌 1
Sam Ritchie04:11:12

https://github.com/sicmutils/sicmutils/blob/main/test/sicmutils/laws.cljc these are some bread and butter mathematical ones I use for all sorts of types

🙌 1
skylize01:11:01

Rewatching this, I realize it is actually a pretty good stepping stone. I must have not been ready to internalize it when I watched it previously. It is the http://fsharpforfunandprofit.com article that @U0NCTKEV8 linked above fleshed out into a 50 minute presentation. https://www.youtube.com/watch?v=IYzDFHx6QPY

skylize22:11:10

Also realizing that even though choosing appropriate properties is probably the more difficult and more important skill in the long-run, the bigger hurdle to getting started is learning to build generators for interestingly shaped data. If anyone is thinking of putting together learning materials on the topic. It would be really helpful to have good lessons available on building small-but-nontrivial generators.

1
p-himik22:11:30

Dan Luu has some interesting materials on testing. Here https://danluu.com/testing/ and elsewhere.

dmegas11:11:04

I’ve found Eric Normand’s talk on testing stateful systems very helpful https://www.youtube.com/watch?v=r5i_OiZw6Sw&amp;t=1349s

skylize13:11:53

@U9V9M9MFZ I've watched that one, and it seems like I will want to come back to it. But there is a humongous chasm between never having written property tests and worrying about how to apply it to stateful things.

dmegas13:11:00

Yes, you are absolutely right, this is indeed a more advanced concept

pithyless08:11:26

@U90R0EPHA I found this particularly helpful to understand generators better: https://www.youtube.com/watch?v=F4VZPxLZUdA

skylize13:11:22

Agreed @U05476190. That vid is how I was actually able get started. But it's a bit of a whirlwind. Still took a lot more digging through the test.check docs and trial and error and dead ends to find my way through my own first example of generating 2 maps from the same list of keys and a list of the keys from one of those maps. And was afterward left still feeling like I don't know what I'm doing.

skylize22:11:10

Also realizing that even though choosing appropriate properties is probably the more difficult and more important skill in the long-run, the bigger hurdle to getting started is learning to build generators for interestingly shaped data. If anyone is thinking of putting together learning materials on the topic. It would be really helpful to have good lessons available on building small-but-nontrivial generators.

1