7

It's quite convenient to implement step definitions using Groovy Script approach, but in this case it's unclear if it's possible to use Spring injection or not.

In case of Groovy script there's no class, just set of closures, like this:

this.metaClass.mixin(Hooks)
this.metaClass.mixin(EN)

Given(~/^we do something$/) { ->    
}

Is there any way to use Spring with Groovy Script?

XZen
  • 225
  • 5
  • 27
  • 49
  • 1
    Groovy works with Spring.. or Spring works with groovy. : http://docs.spring.io/autorepo/docs/spring/3.2.x/spring-framework-reference/html/dynamic-language.html .. what is your real question. – Jayan Apr 08 '16 at 13:12
  • I would also like to know the answer to this. Jayan - this issue is that the the cucumber steps are not real classes - they are a script of closures. – saml Aug 06 '16 at 15:41
  • 1
    Yeah that's correct. Actually I found it much easier to switch to groovy classes and avoid groovy scripts entirely. There're not that many benefits of using groovy script as for me. – XZen Aug 08 '16 at 09:51

0 Answers0