Enable Soft Asserts in Serenity - Cucumber JVM

1,406 views
Skip to first unread message

Vayu Teja Amarnath Navuluri

unread,
Jan 2, 2018, 2:03:19 PM1/2/18
to Serenity BDD Users Group

In Serenity-Cucumber execution, I am trying to insert Soft asserts in the Serenity Steps using the following command

StepEventBus.getEventBus().enableSoftAsserts();

This isn't showing any effective soft Assertion .

Where as when I do the same enableSoftAsserts() through the Step EventBus , 

in the Execution through Serenity-Junit , I am able to achieve the SoftAssertion, i.e. able to execute the Later Steps even a step fails in between.

Can you please let me know how to achive the same SoftAssertion behaviour in Serenity-Cucumber:JVM as that of Serenity-Junit.

Also, I am not using Serenity ScreenPlay, I am just calling enableSoftAsserts() method in the Before Method of Test of Junit.

John Smart

unread,
Jan 2, 2018, 2:09:39 PM1/2/18
to Vayu Teja Amarnath Navuluri, Serenity BDD Users Group
This is an internal API, and I would have to check, but I expect the soft asserts would work within the scope of a step, but not across multiple steps.

--
You received this message because you are subscribed to the Google Groups "Serenity BDD Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-users+unsubscribe@googlegroups.com.
To post to this group, send email to thucydides-users@googlegroups.com.
Visit this group at https://groups.google.com/group/thucydides-users.
For more options, visit https://groups.google.com/d/optout.



--
___________________________________________________
John Smart | Wakaleo Consulting  |  +44 7398 832273
Making smart teams collaborate better
http://johnfergusonsmart.com  |  john....@wakaleo.com
___________________________________________________

We love breaking down silos and helping smart teams collaborate better! Ask about our tailored on-site workshops in Agile Product Planning, BDD Requirements Discovery,  BDD, TDD and Clean Coding, and Advanced BDD Test Automation.

Need some help with Serenity BDD? Check out our Serenity BDD training and support packages here.
___________________________________________________

Vayu Teja Amarnath Navuluri

unread,
Jan 3, 2018, 3:37:28 AM1/3/18
to Serenity BDD Users Group
Thank you John,that was right under the Wire.

Also,I would like to add in some more details on how I used the eventBus call in Junit and Cucumber ,
In JUNIT execution :

I have provided the following call in the @Before method,which enabled soft Assertion across multiple steps
StepEventBus.getEventBus().enableSoftAsserts();


But in Cucumber Execution,

I tried to call the same in @before hook , in the Cucumber Steps and Also in @steps of Serenity. The soft Assertion isn't effective.


Please do let me know if any additional details required on the issue.


Regards,
Amarnath


On Wednesday, January 3, 2018 at 12:39:39 AM UTC+5:30, John Ferguson Smart wrote:
This is an internal API, and I would have to check, but I expect the soft asserts would work within the scope of a step, but not across multiple steps.
On 2 January 2018 at 19:03, Vayu Teja Amarnath Navuluri <vayu...@gmail.com> wrote:

In Serenity-Cucumber execution, I am trying to insert Soft asserts in the Serenity Steps using the following command

StepEventBus.getEventBus().enableSoftAsserts();

This isn't showing any effective soft Assertion .

Where as when I do the same enableSoftAsserts() through the Step EventBus , 

in the Execution through Serenity-Junit , I am able to achieve the SoftAssertion, i.e. able to execute the Later Steps even a step fails in between.

Can you please let me know how to achive the same SoftAssertion behaviour in Serenity-Cucumber:JVM as that of Serenity-Junit.

Also, I am not using Serenity ScreenPlay, I am just calling enableSoftAsserts() method in the Before Method of Test of Junit.

--
You received this message because you are subscribed to the Google Groups "Serenity BDD Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-use...@googlegroups.com.
To post to this group, send email to thucydid...@googlegroups.com.

John Smart

unread,
Jan 3, 2018, 3:40:46 AM1/3/18
to Vayu Teja Amarnath Navuluri, Serenity BDD Users Group
Normally the StepEventBus is an internal API used by the JUnit and Cucumber runners, you aren't supposed to call it yourself from your tests (unless you really know what you are doing). Have you considered just using the AssertJ soft asserts?

To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-users+unsubscribe@googlegroups.com.
To post to this group, send email to thucydides-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages