Replies: 2 comments
-
Here's the outcome of the latest discussion we've just had with @waalge this morning. Aiken's Property-based Testing FrameworkGoals1. Allow Aiken developers to write comprehensive property-based tests for various parts of their Aiken program.For the sake of the argument here, we won't dwell on the differences between property-based testing and fuzzy testing (fundamentally, property-testing is more guided and search for defects in expected behaviors whereas fuzzy testing only looks for the absence for fatal failures from a much wider input domain). So said differently, we want an easier way for Aiken developers to test the behavior of pure functions by supplying arbitrary inputs to them and observing properties that should hold for a chosen input domain. This is currently cumbersome to realize due to the lack of side-effects, and in particular a (pseudo-)random generator. While any Aiken custom-type is in principle representable as a Plutus' Data, we can technically provide default generators for any Aiken type with two gotchas:
Those points mean we need ways of defining and combining custom generators. 2. Minimize the changes to the Aiken language & Rust PVMWe want to avoid, as much as possible, to introduce test-specifics elements to the language. Because these rapidly gets in-the-way of learning and makes the compiler more complex than it needs to be. One other consequence is that it reduces the contribution friendliness to such a framework (e.g. if upgrades to the property-based testing framework require constantly shipping new versions of the compiler). One option we could consider for example is the addition of a new builtin that would act as a (pseudo-)random beacon. Of course, such a builtin would be unacceptable in a validator. This however introduces discrepancy between VMs, and also requires to possibly introduce changes in the VM that we would rather avoid. 3. Keep-it-simple so that it doesn't immediately throw off newcomersProperty-based testing is already in itself a complicated topic. One of the challenge (and desire) we have with this framework is to make property-based testing accessible even to those with little to no experience in functional programming. The most intuitive way to build such an on-chain framework is to rely on a State Monad to provide a declarative API on top of what is effectively a random beacon. In essence, a Current ideas
|
Beta Was this translation helpful? Give feedback.
-
👋 Awesome! This is one of those things that I've talked with KtorZ about often, but never actually gotten around to making a real initiative, so definitely appreciate you stepping up to do the hard part @waalge ;) I'd love to be a help, though time is pretty limited. I also plan on building / proposing a transaction level fuzzer at some point. Given the differences you mention between property based testing and fuzzing, would it make sense to revise some of the terminology? In particular, instead of |
Beta Was this translation helpful? Give feedback.
-
This has come up in other places but afaics there isnt a discussion thread for it (please redirect and close this one if there is)
Beta Was this translation helpful? Give feedback.
All reactions