Where do you put your fuzzers?

Hi,

If you use fuzzing a lot, where do you put your fuzzers ? I can see a few options

  1. tests/SomeModuleTest.elm, seems logical but then it is not entirely clear how to reuse it in some other test. import SomeDataTest exposing (fuzzSomeData) perhaps ?
  2. tests/Fuzzers/SomeDataFuzzer.elm, to cleanly separate the fuzzers from the tests that use them ?
  3. src/SomeData.elm. Makes sense to bring a generator next to its source file, but adds a dependency to elm-explorations/test to the production build, which sounds bad.

I am incorporating some fuzzing in my test suites at the moment and I am wondering what the general usage is, if any…

Go with 1 or 2 – it doesn’t really matter. I don’t think there’s any general usage here – go with whatever makes the most sense to you.

If I only need the fuzzer in one test-file, then I put it there (1).

If I need it in several test-files, then I’ll move it to e.g. tests/TestUtil.elm which includes all utility-functions needed in test-tiles. And if I get a lot of fuzzers there then I can split them to dedicated fuzzers-file/files (2).

If you make sure that you don’t actually use the fuzzer in production code, then elms dead code elimination will completely eliminate this dependency for you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.