How to Get Step Name and Scenario Names through java Coding

619 views
Skip to first unread message

Decentboy Naidu

unread,
Jul 24, 2017, 2:01:54 AM7/24/17
to Serenity BDD Users Group

Hi All,

         I am in the process the leaning the BDD framework and just want to know that, how to get the step name and scenario names which are defined in .feature file through java programming. 


For Example, 

Below is the feature file. 
-----------------------------------


Feature: validate Home page

     Scenario:  Verify HomePage Title

     WHEN Open the Browser 
     THEN  Verify the Title of Home Page


Now,  I want to retrieve the Step,Scenario and Feature Names using the java code. 

Is there any annotation or method to call  before/after every step definition. I know it might be very silly question but it is very useful for me to generate reports. 

Thanks in advance. 

John Smart

unread,
Jul 24, 2017, 2:07:10 AM7/24/17
to Decentboy Naidu, Serenity BDD Users Group
You could write your own StepListener and register it with the StepEventBus. But what problem are you trying to solve?

--
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.
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.
___________________________________________________

Decentboy Naidu

unread,
Jul 24, 2017, 3:58:22 AM7/24/17
to Serenity BDD Users Group, emailt...@gmail.com
Hi John,

           Just want to retrieve the names from feature file and log those names in my project. Could not able to register My own StepListener with StepEventBus. I know its stupid thing, but i would be useful if u can provide the same code for this.
Reply all
Reply to author
Forward
0 new messages