Do not crash when there are abstract classes with cucumber annotations #103

wants to merge 1 commit into


None yet
3 participants

avh4 commented Dec 4, 2011

See issue #102

avh4 commented Dec 4, 2011

On further investigation, this may not be desirable to merge at this time, since there are currently other more fundamental issues that prevent abstract stepdef classes from being usable. (Specifically, when multiple features are run in a single junit run, stepdefs from other packages are not completely cleared out of the picocontainer, causing injections to fail when building the world if there are multiple subclasses of an abstract stepdefs class.)


aslakhellesoy commented Dec 11, 2011

Yes, I'm very sceptical about inheritance and abstract classes in general, and especially for stepdefs.

I think the solution is to document this better, so that people who are inclined to use inheritance can learn how to use delegation and dependency injection instead.


vasiliygagin commented Jan 31, 2012

We have encountered this (or similar) issue when we tried to create base class with @before method to initialize / reset mocks. When cucumber discovered inherited method in our step def class, it tried to instantiate declaring class for it.
Not sure what would be the reason why cucumber would specifically try to instantiate declaring class. Seems like a bug.

It would benefit us if this issue will be fixed.


aslakhellesoy commented Feb 1, 2012

Please open a new ticket with:

  • cucumber version
  • relevant code snippets
  • stack trace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment