Live data from Hacker News

Test-case reducers are underappreciated debugging tools

tratt.net

21–23 of 23 posts

Re: Test-case reducers are underappreciated debugging tools

#21
post #10

I have a similar tool to shrink ray, called [bonsai]( https://github.com/nnunley/bonsai ). I designed it to allow me to try to inline and reduce code for both simplifying single file examples, as well working across multiple files. It uses Tree-Sitter for syntax awareness, and the [Perses algorithm]( https://doi.org/10.1109/ICSE.2018.00046 ) as the methodology for simplification. I'd love to get some feedback if anyo…

What a great idea to include tree sitter

Re: Test-case reducers are underappreciated debugging tools

#22

I read the first part of this article, then gave up and Googled "Test-case Reducers". I'm not sure if that's an article failure (that I didn't want to read a whole ton of text and C code details), or a success (as it got me interested in the topic). I guess both?

I read the whole article, and I am still confused. I get that test case reducers find the smallest error causing string. I don't understand why that is particularly valuable. Also, do test case reducers work on integers or other numbers? What about reducing some other complexity? Is this for developing unit tests or just debugging?

Reduced test cases make it way easier to figure out what the actual bug is. E.g. a real world example is when I tested a "slugify" function with hypothesis. It almost immediately spat out this failing test case:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaẞ

Boy I sure do wonder what character could possibly be causing issues there. whereas without shrinking it might instead spit out something like

ЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДẞЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп

Which makes finding the offending character a lot harder.

Post reply on HN