4 ms·
Alternative title: “Scientist: A Ruby library for changing production code while still not having to write tests”
by tobyhinloopen 7y ago
Alternative title: “Scientist: A Ruby library for changing production code while still not having to write tests”
- hinkley 7y agoIn TDD they might call these pinning tests. This kind of testing isn’t just good for refactors. You can also use it for rewrites or substantial architectural changes. I think github did something like this while trying to make the storage format more efficient.
- hamandcheese 7y agoWhich is really valuable if you don’t have tests, or your test suite doesn’t give you much confidence, is too brittle to make the changes without breaking the tests, or maybe the code is structured so that it’s really hard to test all the paths that occur in production.
- Xylakant 7y agoEven in a well-tested codebase some integration points are extremely hard to test, notably external services that you connect to. Rewriting these to use a different service or just a different way of connecting to a service would be an example where this ends up being useful.
- jbarnette 7y agoBy the time we extracted Scientist, the code we were refactoring had pretty good test coverage. But even the best test suite is an imperfect model of production. The first section of the README briefly mentions this: "Let's pretend you're changing the way you handle permissions in a large web app. Tests can help guide your refactoring, but you really want to compare the current and refactored behaviors under load."