serenity-bdd / serenity-cucumber4

Other
13 stars 10 forks source link

Serenity and Selenide with Cucumber4 #6

Open SeleniumTestAB opened 5 years ago

SeleniumTestAB commented 5 years ago

Hello,

I am trying to add Selenide Webdriver into Serenity Suite with Cucumber4. However, i am experiencing an issue with how Serenity (or maybe Cucumber4) works with browser threads.

Basically Selenide bounds it's driver (or driver we provide) to the thread pool and after calling method to open() browser it does it's workings. But after going trough a feature file the current thread is closed and Selenide with it.

My issues with that is that the application has several areas connected with each other (like big receipt that has several tabs and sections). Making each test for each section to open new browser and getting to that point is not good.

Is there a way to tell Serenity to not close current thread after each feature file? I tried serenity.restart.browser.for.each=NEVER option but it did not work. Also i setup my custom provided with: webdriver.driver = provided webdriver.provided.type = mydriver webdriver.provided.mydriver = //pathToClassWithDriverSourceImplemented serenity.driver.capabilities = mydriver

but after quick debug i see that contents of that provider are not even touched.

Regards,

wakaleo commented 5 years ago

I would advise against using a Custom driver if you can. Cucumber makes it hard to know when all the features are finished, so restart.browser.for.each=feature is about the best you can do. Which Selenide features are you after? Serenity also has very similar fluent API methods within Page Objects and action classes, which might be sufficient for your needs.

SeleniumTestAB commented 5 years ago

My whole project and experience is based on Selenide. So mostly that, and i am sure it will not fail vs angualr applications and such. However i really like the approach of Serenity Living Documentation and i want to merge both of this worlds.

In longer answer: Selenide and Serenity do share similar approach in writing test steps/definitions (sources) but Selenide in my point of view is more flexible than Serenity in that regard. You do not need to extend a specific class to make use of Selenide driver. You can set that driver in various methods (using their configuration variables, making custom provider or using typical setter in their WebDriverRunner). Also, since i did not use a Serenity waiters, i can only speak from Selenide perspective, their conditional waits are very efficient.

Thats about it in nutshell.

I could only suggest one thing. Making TestNG suite feature available as well in Serenity. Cucumber does support it so why not Serenity? (that is about cucumber not knowing if features did finish).

wakaleo commented 5 years ago

If you are familiar with TestNG you are most welcome to contribute a driver.

SeleniumTestAB commented 5 years ago

I only familiar with using it. I am not an expert with its inner workings, sadly. Is there no other way?

wakaleo commented 5 years ago

If this is an important feature for you you can always ask your company to raise a one-offcsupport request or subscribe to a support contract (see https://johnfergusonsmart.com/serenity-bdd-mentoring).