Extracting Values
Copy return values directly from JSON output into test assertions.
The primary use case: a test fails, you instrument the method, the JSON shows you the actual value, you update the assertion. No debugger, no println, no guessing.
Copying values into assertions
String values — already quoted in the output, paste directly:
// From output: "return":"a and b and c"
assertEquals("a and b and c", result);
Numeric values — bare in the output:
// From output: "return":42
assertEquals(42, result);
Null:
// From output: "return":null
assertNull(result);
Boolean:
// From output: "return":true
assertTrue(result);
Grepping for specific output
All Jackknife output:
Grep "JACKKNIFE" target/surefire-reports/
Failures only:
Grep '"status":"thrown"' target/surefire-reports/
The workflow loop
- Instrument the method:
mvn jackknife:instrument -Dclass=com.example.Foo -Dmethod=bar - Run the test:
mvn test -pl my-module - Read the output — the actual args and return values are right there
- Fix the assertion
- Clean up:
mvn jackknife:clean