Automatically updates regression tests based on interval analysis to maintain coverage of key program intervals. Use when code changes affect value ranges, conditionals, or control flow, and existing tests need updating to maintain interval coverage. Analyzes interval information from updated code, identifies coverage gaps, adjusts test inputs and assertions, removes redundant tests, and generates new tests for uncovered intervals. Supports Python, Java, JavaScript, and C/C++ with various test frameworks (pytest, JUnit, Jest, Google Test).
Install with Tessl CLI
npx tessl i github:ArabelaTso/Skills-4-SE --skill interval-guided-regression-test-update82
Does it follow best practices?
If you maintain this skill, you can automatically optimize it using the tessl CLI to improve its score:
npx tessl skill review --optimize ./path/to/skillValidation for skill structure
Automatically update regression tests to maintain interval coverage when program code changes.
Intervals represent ranges of values that variables can take during execution. When code changes, intervals may be added, removed, or modified. This skill ensures regression tests continue to cover all important intervals.
Example:
# Old code
def process(x):
if x < 10:
return x * 2
else:
return x + 10
# Intervals: [0, 10), [10, ∞)
# New code (added negative handling)
def process(x):
if x < 0:
return -x
elif x < 10:
return x * 2
else:
return x + 10
# Intervals: (-∞, 0), [0, 10), [10, ∞)
# Need to add test for new interval: x < 0Parse the current regression test suite:
# Example test analysis
test_process_small: input=5, covers [0, 10)
test_process_large: input=15, covers [10, ∞)
# Coverage: 2/2 intervals = 100%Obtain interval information from the updated program:
From static analysis:
From profiling:
From symbolic execution:
See references/interval-analysis.md for detailed extraction methods.
Compare current coverage with new intervals:
old_intervals = {[0, 10), [10, ∞)}
new_intervals = {(-∞, 0), [0, 10), [10, ∞)}
added_intervals = {(-∞, 0)} # Need new test
removed_intervals = {}
modified_intervals = {}Apply appropriate update strategies:
Add tests for new intervals:
# New test for (-∞, 0)
def test_process_negative():
assert process(-5) == 5Adjust inputs for modified intervals:
# If boundary changed from x < 10 to x < 20
# Old: test_process_large with input=15
# New: test_process_large with input=25Update assertions for changed behavior:
# If logic changed
# Old: assert process(5) == 10
# New: assert process(5) == 15Remove redundant tests:
# If intervals merged, remove duplicate coverageSee references/test-update-strategies.md for detailed strategies.
Run the updated test suite:
Provide comprehensive summary:
Scenario: Function adds handling for negative numbers
Original code:
def abs_double(x):
if x < 10:
return x * 2
else:
return x + 10Original tests:
def test_small():
assert abs_double(5) == 10
def test_large():
assert abs_double(15) == 25Updated code:
def abs_double(x):
if x < 0:
return -x * 2
elif x < 10:
return x * 2
else:
return x + 10Updated tests:
def test_negative(): # NEW
assert abs_double(-5) == 10
def test_small():
assert abs_double(5) == 10
def test_large():
assert abs_double(15) == 25Summary:
Scenario: Threshold value modified
Original code:
def categorize(score):
if score < 60:
return "fail"
else:
return "pass"Original tests:
def test_fail():
assert categorize(50) == "fail"
def test_pass():
assert categorize(70) == "pass"Updated code:
def categorize(score):
if score < 50: # Changed from 60
return "fail"
else:
return "pass"Updated tests:
def test_fail():
assert categorize(40) == "fail" # Changed input from 50
def test_pass():
assert categorize(60) == "pass" # Changed input from 70Summary:
Scenario: Simplified logic combines cases
Original code:
def classify(x):
if x < 0:
return "negative"
elif x == 0:
return "zero"
else:
return "positive"Original tests:
def test_negative():
assert classify(-5) == "negative"
def test_zero():
assert classify(0) == "zero"
def test_positive():
assert classify(5) == "positive"Updated code:
def classify(x):
if x <= 0:
return "non-positive"
else:
return "positive"Updated tests:
def test_non_positive(): # Merged
assert classify(-5) == "non-positive"
assert classify(0) == "non-positive"
def test_positive():
assert classify(5) == "positive"Summary:
Modify test inputs to cover new or changed intervals.
When to use:
How:
Modify expected values when behavior changes.
When to use:
How:
Remove redundant or obsolete tests.
When to use:
How:
Create new tests for uncovered intervals.
When to use:
How:
Interval Coverage = (Covered Intervals) / (Total Intervals) × 100%Example:
Total intervals: 4
Covered by tests: 3
Coverage: 75%Interval Coverage Report
========================
Before Update:
- Total intervals: 2
- Covered intervals: 2
- Coverage: 100%
After Update:
- Total intervals: 3
- Covered intervals: 3
- Coverage: 100%
Changes:
- Added intervals: 1
- Removed intervals: 0
- Modified intervals: 0
Test Changes:
- Added tests: 1
- Modified tests: 0
- Removed tests: 0Problem: Code refactored, some logic changed
Solution:
Problem: New feature adds new code paths
Solution:
Problem: Bug fix changes behavior in specific interval
Solution:
Check:
Solution:
Check:
Solution:
Check:
Solution:
c1fb172
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.