Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • I started to consider this option after having some trouble to write tests for heavy boolean expression. I considered the refactoring approach as suggested by MainMa, but then I considered truth tables (and generator for the parameter combinations). I asked the question here because I wanted to have hints from others before going to deep in this solution. Commented Jun 27, 2014 at 10:28
  • +1, but the problem remains, he has a way too complicated method in terms of testing. Commented Jun 27, 2014 at 11:02
  • @SilviuBurcea sure, I've mentioned one possible refactor, there are others though, e.g. extract method which MainMa covers Commented Jun 27, 2014 at 11:14
  • You can do both. Make functions that don't try to do too much by themselves, then write lists of tuples that cover all the cases you need to cover for each function. For very complex input I've resorted to the "data file" technique but regretted it because the file I/O made the unit tests run slowly. Commented Jun 27, 2014 at 14:45
  • @DavidK yes for unit test it might be too slow with a file, this is more target to integration tests Commented Jun 27, 2014 at 15:04