feat: Split TimeTaken metric into ExecutionTime and WaitTime #3354
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 Pull Request Title
Improve Test Reporting: Separate Execution Time & Wait Time while keeping Total Runtime
📘 Overview
This PR enhances the accuracy and clarity of test performance metrics reported by Keploy.
Previously, all delays — including actual processing time and artificial waits — were mixed into the single TimeTaken value.
Now, the metrics are broken down into:
🕒 ExecutionTime — Real request processing duration
⏳ WaitTime — Artificial waits (configured delays or internal sleeps)
🧮 TotalRuntime (TimeTaken) — ExecutionTime + WaitTime (backward compatible)
This helps in better debugging, performance profiling, and benchmarking.
🔧 Code Changes
• pkg/models/testrun.go
• pkg/service/replay/replay.go
Example Updated Logs Output:
Execution time: 3.12s
User wait time: 5.00s
Total runtime: 8.12s
🧪 How to Test
Run a test set with a configured delay:
keploy test -c "go run main.go" --delay 5
Expected:
• ExecutionTime ≈ real processing time
• WaitTime ≈ 5 seconds
• Total runtime = sum of both
🎯 Benefits
✔ More accurate timing insights
✔ Easy identification of bottlenecks
✔ Better performance benchmarking
✔ Still fully backward compatible
🔍 Notes for Reviewers
• Validate that coverage and mocks remain unaffected
• Check reports for both CLI logs and stored YAML/JSON
• No breaking changes expected — backward compatibility preserved
📎 Ticket Reference
Closes: (Add issue link if exists)
✔ Checklist
Issue: #3351