Custom options in Tasty

Published on

Tasty 0.6 is released, making it possible to create custom options just for your test suite!

Add your own option in three easy steps:

  1. Define a datatype to represent the option, and make it an instance of IsOption
  2. Register the options with the includingOptions ingredient
  3. To query the option value, use askOption.

Examples follow.

Ignoring a test

My use case is a test suite that has a number of tests that fail on a certain build bot. I can’t fix the build bot configuration ATM, so I’d like to be able to mark these tests as known-fail in the build script for this particular build bot. — 23Skidoo

To some extent this is just a way around Tasty’s limited pattern language (which will improve, too!), but I still find it pretty nice.

With the following code, you can disable the second test by passing a --buildbot command-line option.

Controlling the depth

When running the tests is there any general solution to set the Depth parameter for the (individual) tests, or better yet, a fine grained solution to set the Depth parameter for individual fields? — jules

Not that I recommend doing this — see this answer.

But here’s how you can do it if you’re sure you want it.

(This was also possible to hack with earlier versions of Tasty — see this gist).

To increase the depth of p1 to 20, pass --smallcheck-depth-p1 20 on the command line.