-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduced mockito usage #2767
base: main
Are you sure you want to change the base?
Reduced mockito usage #2767
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2767 +/- ##
============================================
+ Coverage 84.99% 85.00% +0.01%
- Complexity 2734 2736 +2
============================================
Files 331 331
Lines 9559 9559
Branches 918 918
============================================
+ Hits 8125 8126 +1
Misses 1109 1109
+ Partials 325 324 -1 ☔ View full report in Codecov by Sentry. |
cucumber-core/src/test/java/io/cucumber/core/plugin/PluginsTest.java
Outdated
Show resolved
Hide resolved
I'm halfway through reviewing this. Made #2783 to reduce the size a bit. |
I removed all mockito usages. I'm happy with the performance improvement on interactive tests, |
cb73b60
to
56ea5b3
Compare
🤔 What's changed?
I reduced the usage of the Mockito framework. This is a first pass, focused on the simple cases (typically: replacing the mock+when constructs with stub classes).
⚡️ What's your motivation?
Fixes #2707 .
By focusing on the simple cases we have a big pull request of stuff that is simple to review. The other replacements are more complex and prone to more discussions, so I will make another pull request for them.
🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
Performance when running all tests using Intellij (right click on project -> Run -> All Tests ; average duration over 5 runs):
Thus, when running tests interactively, we see a good improvement by not using mockito (up to 72% of testing time on cucumber-java).
However, over the full build (maven clean install on cucumber-jvm), there is no build time difference: on my machine, the build time is 1 minute 49 seconds on themain
branch as well as on branchreduce-mockito-usage-pass1
(average build time over 5 builds).My guess is that the build time is much longer than the test duration, so the test duration on total maven clean+install is not noticeable.Edit:
One year after, I did additional tests on my local machine for a
maven clean install on cucumber-jvm
(5 times average):main
branch ): average=3 minutes 42 seconds (standard deviation = 8 seconds)reduce-mockito-usage-pass1
branch): average=3 minutes 26 seconds (standard deviation = 12 seconds)That is: the build is 7% faster without mockito.
📋 Checklist: