There is a need for refactoring, so that future additions and bugfixes can be applied in a timely manner. The fear is, that although the code will be "only" refactored, that this might break the behavior in unforeseen ways.
Desired Outcome
Have a safety net in place, so that refactoring can be done without fear.
Solution
Add approval tests. Approval tests are a technique to write test, where the output of a action is persisted to disks and subsequent calls are compared to the version stored on disk. Another name is snapshot tests. This technique is usually applied to legacy codebases, where there is not a good unit test coverage and where to add good unit tests, the code needs to be first refactored to make it testable.
related to DEV-3400
Problem Statement
There is a need for refactoring, so that future additions and bugfixes can be applied in a timely manner. The fear is, that although the code will be "only" refactored, that this might break the behavior in unforeseen ways.
Desired Outcome
Have a safety net in place, so that refactoring can be done without fear.
Solution
Add approval tests. Approval tests are a technique to write test, where the output of a action is persisted to disks and subsequent calls are compared to the version stored on disk. Another name is snapshot tests. This technique is usually applied to legacy codebases, where there is not a good unit test coverage and where to add good unit tests, the code needs to be first refactored to make it testable.