-
Notifications
You must be signed in to change notification settings - Fork 470
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
Changed "eventually" usage example to reflect asynchronous logic #990
base: master
Are you sure you want to change the base?
Conversation
I've attempted to make the usage example more transparent, as I've lost track on how many times I've been asked why the "machine" variable isn't (magically) updated by Spock. And I attempt to explain that the original Machine example seems to be thread-based. Hopefully this change aids those who use PollingConditions to test asynchronous logic.
What makes the new example more clear in your opinion? |
I was trying to make the current example more accessible, while trying to be concise. Instead the programmer must either
Coming back to this PR I can see that perhaps it's not transparent that I'm assuming the reader will understand that there's a Any suggestions? |
Codecov Report
@@ Coverage Diff @@
## master #990 +/- ##
============================================
- Coverage 75.99% 74.01% -1.98%
+ Complexity 3544 3432 -112
============================================
Files 377 382 +5
Lines 10788 10612 -176
Branches 1374 1295 -79
============================================
- Hits 8198 7855 -343
- Misses 2109 2296 +187
+ Partials 481 461 -20
Continue to review full report at Codecov.
|
I also don't understand how the new example is any better than the old example. |
Hi @Vampire,
That's the question I so far always have to explain to my fellow developers, that's stumped by the current I've seen a lot of code like the example below from new developers introduced to
The above example ends up looping over the state from the initial invocation, and hence never succeeds. In-order to get the desired behavior instead, I've approached it as follows.
Well, I was hoping it was possible to collaborate with the maintainers/community in-order to distill an example that doesn't need further explanation to an inexperienced Spock developer. The current commit is my initial attempt from last year, I'm happy to update it based on suggestions. |
Well, this depends heavily on how the domain objects work. If this is not the case and the first example is used, it imho only shows that the respective developer did not understand how the asynchronous operation works actually. I don't think that the second example is any clearer or more correct, especially without information on how the domain object is actually working. |
I've attempted to make the usage example more transparent, as I've lost track on how many times I've been asked why the "machine" variable isn't (magically) updated by Spock.
And I attempt to explain that the original Machine example seems to be thread-based.
Hopefully this change aids those who use PollingConditions to test asynchronous logic.
This change is