You're not allowed to extend classes that define Step Definitions or hooks

1,321 views
Skip to first unread message

Bob Marius

unread,
Sep 17, 2014, 9:06:25 AM9/17/14
to cu...@googlegroups.com
Hi there,

I have a tutorial project which is using Appium for automating some tests for and Android application.
The project is located at this link: https://github.com/appium/tutorial/tree/master/projects/java_android
As you can notice in the AppiumTest.java class( https://github.com/appium/tutorial/blob/master/projects/java_android/src/test/java/appium/tutorial/android/util/AppiumTest.java), there are hooks defined there and that class is extended wherever we want to use them.

When including cucumber-jvm in the project, I had run into cucumber.runtime.CucumberException: You're not allowed to extend classes that define Step Definitions or hooks. issue.

My question is if someone had this situation already where you want to share some setup with the other test classes without  implementing the @Before / @After annotations in every test class. Or what workaround will be more appropriate in order to address this exception?

Thank you!

Björn Rasmusson

unread,
Sep 17, 2014, 12:49:19 PM9/17/14
to cu...@googlegroups.com
Bob Marius wrote:
Hi there,

I have a tutorial project which is using Appium for automating some tests for and Android application.
The project is located at this link: https://github.com/appium/tutorial/tree/master/projects/java_android
As you can notice in the AppiumTest.java class( https://github.com/appium/tutorial/blob/master/projects/java_android/src/test/java/appium/tutorial/android/util/AppiumTest.java), there are hooks defined there and that class is extended wherever we want to use them.
Hi,

No I do not find any hooks in AppiumTest.java, only methods annotated with org.junit.Before and org.junit.After. The Cucumber hook annotations are cucumber.api.java.Before and cucumber.api.java.After.
 

When including cucumber-jvm in the project, I had run into cucumber.runtime.CucumberException: You're not allowed to extend classes that define Step Definitions or hooks. issue.

Are you sure that the exception has anything to do with the org.junit.Before/After annotations in AppiumTest?

Best Regards
Björn
 
Reply all
Reply to author
Forward
0 new messages