Stream: beginners

Topic: property based testing


view this post on Zulip drew (Aug 28 2024 at 02:12):

Is there a way to do property based testing with expect at this time?

view this post on Zulip Brendan Hansknecht (Aug 28 2024 at 02:30):

Nope.

view this post on Zulip Luke Boswell (Aug 28 2024 at 02:44):

Brendan has done a lot of work investigating this. Here is a previous post with some links.

https://roc.zulipchat.com/#narrow/stream/395097-compiler-development/topic/Property.20testing.20and.20fuzzing/near/418548020

view this post on Zulip Richard Feldman (Aug 28 2024 at 02:47):

you can do a weak form of it at the moment, where you hardcode a seed and randomly generate things

view this post on Zulip drew (Aug 28 2024 at 02:48):

makes sense

view this post on Zulip Richard Feldman (Aug 28 2024 at 02:48):

I would definitely like to be awesome at it in the future, though!

view this post on Zulip drew (Aug 28 2024 at 02:49):

yeah, totally. i think unison is a cool example of supporting “inline-ish” property based testing

view this post on Zulip drew (Aug 28 2024 at 02:49):

of course unison has some unique characteristics too

view this post on Zulip Richard Feldman (Aug 28 2024 at 02:50):

I'm not familiar with what Unison does on that! How does it work?

view this post on Zulip drew (Aug 28 2024 at 02:50):

one sec

view this post on Zulip drew (Aug 28 2024 at 02:51):

https://www.unison-lang.org/docs/usage-topics/testing/ is a good read

view this post on Zulip Luke Boswell (Aug 28 2024 at 02:51):

Do we have enough of a starting point that we could make an Issue for roc fuzz that if someone was interested might be able to pickup and do some research?

view this post on Zulip Luke Boswell (Aug 28 2024 at 02:53):

My thoughts is how can we capture the general intention to explore fuzzing and one day include it in roc. It may also be a cool project someone might want to contribute and learn more about the science and engineering behind fuzzing testing.

view this post on Zulip drew (Aug 28 2024 at 02:53):

codebases in unison are like small talk images (i think), so i’m not sure how much some of the choices apply to roc

view this post on Zulip Brendan Hansknecht (Aug 28 2024 at 03:02):

I think in practice we should make a property based testing framework for the simplicity and minimal dependencies. Long term, we should ensure that it can also be used with a fuzz engine for more comprehensive testing. Whether long term we follow in Go's footsteps and have an integrated fuzz engine to fix the dependency problems or make it easy for an external fuzz engine to hook in is still very much open for design. But for simple unit testing, a basic property based testing framework would be huge. Some like hypothesis in python.

view this post on Zulip Richard Feldman (Aug 28 2024 at 03:05):

oh I think we can make it all builtin

view this post on Zulip Richard Feldman (Aug 28 2024 at 03:06):

including things like automatically deriving Arb

view this post on Zulip Richard Feldman (Aug 28 2024 at 03:06):

the way we do for encoders and decoders etc.

view this post on Zulip Luke Boswell (Aug 28 2024 at 03:12):

@Brendan Hansknecht what do you mean by "framework". We don't normally talk about these in roc. Is this a user space roc package? or a specific platform?

view this post on Zulip Brendan Hansknecht (Aug 28 2024 at 04:24):

sorry, bad wording on my part. I think it should be built into the compiler and into expect. We should have an Arbitrary implementation that would start simple and for raw PBT only, but would be open to tying into a fuzzing harness.


Last updated: Jul 06 2025 at 12:14 UTC