I try to understand more about how Geb and Spock work internally to understand what is really happening in my tests. I found that GebSpec which I extend to write my tests has a field Browser _browser. I also found that GebSpec has a method getBrowser() which returns _browser, so _browser can be accessed over getBrowser() and get_browser(). But the interesting part is that while debugging in intelliJ expanding an instance of GebSpec shows no field _browser but only a field $spock_sharedField__browser. A little example:
How do they manage to hide the _browser field from me in the debugger and why do they do it? Recall a field Browser _browser is declared in GebSpec and a field $spock_sharedField__browser is not. There also is no method get$spock_sharedField__browser() but i still can access and manipulate $spock_sharedField__browser. I tried to do it myself:
Can someone explain me what is going on? Why hide _browser? What is $spock_sharedField__browser good for?
Aucun commentaire:
Enregistrer un commentaire