Samstag, 27. September 2014

Spock Old Feature

Yesterday I watched the Idiomatic Spock presentation with Rob Fletcher on YouTube, a great talk about testing with Spock. A small feature I didn't know that this exits in Spock is the old method. With this static method from the Spock framework you can get a value from the test subject before the actions in the "when:" block are executed. This is done in Spock by some byte code magic (AST transformation), in the debugger you will see that the statement in the old method is executed before the statements above. This feature helps to get a clean and stable test logic and it can be use for example to verify that a size of a collection is increased, here a simple Spock specification which verify that the stack size is increased by using the Spock old Feature.

More Spock magic, patterns and anti patterns can be found in idiomatic-spock demo project on GitHub from Rob Fletcher and in his presentation on YouTube.

1 Kommentar:

  1. thanks for sharing this article to us , it is very nice article ,
    i really like like this article because i got good info about this article thanks for sharing this article to us best regards.
    sap netweaver training in hyderabad

    AntwortenLöschen