Using Junit Rules annotation with Cucumber annotations

218 views
Skip to first unread message

Mark Winspear

unread,
Oct 29, 2015, 6:42:16 AM10/29/15
to Cukes
Hi

I'm looking at setting up a small proof of concept using:
Cucumber
Selenium Webdriver
Maven (to manage dependencies and also run tests)
Sauce labs (to execute on multiple OS, browsers on their VMs in the cloud)
Jenkins (to run multiple jobs executing on sauce labs) with Sauce labs and Cucumber-reporting plugins

I have successfully set up projects using all of the above except Cucumber.  In order to integrate with saucelabs, I had to use JUnit annotations @Rule (as well as @Before, @Affer and @Test) as well as a TestWatcher.

Before I start this work, is it possible to use JUnit annotations and cucumber annotations in the same helper class? (I note that cucumber annotations only consist of @Before and @After)

Are there any gotchas that anyone can highlight upfront with the setup described?

Many thanks

Mark

Vaibhav Tiwari

unread,
Aug 19, 2016, 12:37:46 PM8/19/16
to Cukes
Hi Mark,

Did you find any workaround for this issue.

I am also having the same requirement as stated by you. Let me know if you have finalized any solution for it.

Thanks,
Vaibhav

80Vikram

unread,
Jun 3, 2017, 6:48:15 AM6/3/17
to Cukes
Hi Mark, Vaibhav,

Can you please share if you found any workaround ?

Thanks,
Vikram

Oleksandr

unread,
Oct 24, 2017, 4:20:59 AM10/24/17
to Cukes
Hi Mark, Vaibhav, 80Vikram

I have the same problem with cucumber. Please share if you found any decision. I would be very grateful)

Thanks,
Oleksandr

четверг, 29 октября 2015 г., 12:42:16 UTC+2 пользователь Mark Winspear написал:

MP Korstanje

unread,
Oct 25, 2017, 4:39:36 AM10/25/17
to Cukes
The only supported JUnit annotations currently are `@ClassRule`, `@BeforeClass`, `@Afterclass` on the runner. These are invoked around the whole test suite.

If you want to use external reporting tools it is recommended you look at the implementation of JSONFormatter. You might have to look into what SauceLabs annotations do and replicate that in the reporter.

Best,
MP
Reply all
Reply to author
Forward
0 new messages