Screenplay and Cucumber examples. worth it?

1,719 views
Skip to first unread message

Vincent Brouillet

unread,
Oct 7, 2016, 5:48:58 AM10/7/16
to Serenity BDD Users Group
Is there an example somewhere of the screenplay pattern with Cucumber JVM?   I know it might be trivial to adapt the demo project on github but it would help my team.

Does it still make sense to use Cucumber with the screenplay pattern?

I see the doc in Serenity does not make much use of Cucumber anymore. However I must say the reports can still produce the Gerhkin syntax. So we are not loosing here.
So should we just forget about Cucumber and just follow the examples as they are?

I liked that the BA/QA could write the feature files and send to developers. A cucumber run produces the missing steps and voila...

John Smart

unread,
Oct 7, 2016, 5:51:59 AM10/7/16
to Vincent Brouillet, Serenity BDD Users Group
Sure, there is strong support for Cucumber (and JBehave) in Screenplay. Have a look at https://github.com/serenity-bdd/screenplay-pattern-todomvc, there are some example there. The doc will be updated in due course :-).

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

Jeff Nyman

unread,
Oct 7, 2016, 7:13:56 AM10/7/16
to Serenity BDD Users Group
For whatever it's worth, I'm working on a tutorial for this literally right now and a sample project.

The trick is sometimes figuring out where to put things like @Managed or how to use the actor concept in the context of Cucumber, because you have multiple abstractions working simultaneously.

I know none of this helps you right now but I'll post a link once this is finished. In the meantime, when I get a working implementation that is as scaled back as possible, I'll put it on a GitHub repo.

John Smart

unread,
Oct 7, 2016, 7:20:09 AM10/7/16
to Jeff Nyman, Vincent Brouillet, Serenity BDD Users Group
It's not well documented yet, but there is a lot of support for this in the Screenplay library. In a nutshell:

First, set the stage:
@Before
public void set_the_stage() {
OnStage.setTheStage(new OnlineCast());
}
The cast is the set of actors you use in your scenarios. You can either use the bundled OnlineCast (where all the actors have the ability to browse the web), or write your own extension of the Cast class.

If you name the actor in the step, use theActorCalled():
@Given("^that (.*) has an empty todo list$")
public void that_James_has_an_empty_todo_list(String actorName) throws Throwable {
theActorCalled(actorName).wasAbleTo(Start.withAnEmptyTodoList());
}
If you are saying he or she, use theActorInTheSpotlight():
@When("^s?he adds '(.*)' to (?:his|her|the) list$")
public void adds_Buy_some_milk_to_his_list(String item) throws Throwable {
theActorInTheSpotlight().attemptsTo(AddATodoItem.called(item));
}




--
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.
For more options, visit https://groups.google.com/d/optout.

Jeff Nyman

unread,
Oct 7, 2016, 7:27:37 AM10/7/16
to Serenity BDD Users Group, jeff...@gmail.com, vincent....@gmail.com
Interesting!

Okay, so in that example, is "theActorInTheSpotlight()" an instance of the Cast class? Also where would "actorName" be set in this context? Would you just create an Actor instance in the @Before.

The trick is making sure that the actor can be the same context across steps when those steps are in different files. For example, I might have NavigationSteps and then LoginSteps. The @Given for a particular scenario is in NavigationSteps whereas the @When and @Then might be in LoginSteps. But the actor will be the same.

Jeff Nyman

unread,
Oct 7, 2016, 7:40:56 AM10/7/16
to Serenity BDD Users Group, jeff...@gmail.com, vincent....@gmail.com
Never mind my question on "actorName". I was thinking of something else. I realize actorName is the parameter name passed in.

I'm working on an example now. I have a working example of a Cucumber-with-Serenity project that I documented here:


But that doesn't use screenplay. It does use @Steps. So I'm trying to see how to put all these ideas together.

Vincent Brouillet

unread,
Oct 7, 2016, 7:13:53 PM10/7/16
to Serenity BDD Users Group, jeff...@gmail.com, vincent....@gmail.com

Yeah I reckon if we had a couple of examples with the full flow from cucumber feature files all the way, I'll be able to use that.

Thanks John for the steps examples, I'll try to combine that with the TODO github example.

Looking forward to more tutorials. It's  bit of steep learning curve 

lukerl

unread,
May 26, 2017, 7:27:43 AM5/26/17
to Serenity BDD Users Group
Hello,

I didn't wanted to create a separate thread as you already discuss here about sample projects, but I feel the need to address this here.

Why there's no sample project around Screenplay + Cucumber, beside the https://github.com/serenity-bdd/screenplay-pattern-todomvc

Because, I find hard to understand that sample project as is mixed with Page-Objects, junit  ...

Can we have an mvn archetype for Screenplay with Cucumber-JVM as we have with junit ?

Also, there's an issue in the serenity.properties with the sample project specified above, when I define for iexplorer the capabilities
serenity.driver.capabilities=ENABLE_PERSISTENT_HOVERING:true;ENSURING_CLEAN_SESSION:true

values are not taken into account, everytime I run the test the items add-up and ofcourse the tests fail, which is ok, but why there's no support for iexplorer in serenity.properties to declare preferences and args like for chrome (i.e. https://johnfergusonsmart.com/configuring-chromedriver-easily-with-serenity-bdd/ )

I don't want to initiate another call to the webdriver in a custom class to set this capabilities.

So, any hints to this issues and the sample project?


Thanks.

Diana Carmen

unread,
Jun 4, 2018, 9:29:49 AM6/4/18
to Serenity BDD Users Group
Hello,

Is there by now an example project with Screenplay and Cucumber?

I am also working on putting the puzzle pieces together, hopefully someone has documented this somewhere?

Thanks,
Diana
Reply all
Reply to author
Forward
0 new messages