How to use instance variable in Spock Test section

Spock only allows access to static variables from a block.

Is there any workaround with which instance variables can be used inside the where block?

+4
source share
1 answer

You can annotate instance variables with @Shared, see http://spockframework.imtqy.com/spock/docs/1.0/data_driven_testing.html#sharing-of-objects-between-iterations .

: . , . , , , where, .

+8

Source: https://habr.com/ru/post/1533865/


All Articles