Regression Testing ensures that new changes or features do not break existing functionality. It’s a type of testing that’s performed after code changes to verify that the new changes didn’t introduce any new bugs or break previously working features.
Purpose: To ensure that previously working code still functions after changes, whether it’s new features, bug fixes, or updates.
When to use: Every time you add a new feature, fix a bug, or make changes to the codebase. Regression tests should be run continuously to ensure the software maintains its stability.
Example: After updating a method to handle new requirements, regression testing would ensure that the existing functionality still works:
RSpec.describe 'Order Processing' do
it 'processes the order correctly even after adding a discount feature' do
expect(process_order(order)).to eq(expected_output)
end
end