serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
723 stars 518 forks source link

java.lang.NullPointerException: No BaseStepListener has been registered - are you running your test using the Serenity runners? #3034

Open UltraLas3r opened 1 year ago

UltraLas3r commented 1 year ago

image

I saw that this issue was brought up before, however, none of the answers were clear enough. I've searched all over and everything seems to be in the right spots on my end.

Does anyone know what might be happening?

My step definition script has image

and I have a CucumberTestSuite file... I am trying to follow a simple tutorial https://expansion.serenity-dojo.com/courses/take/serenity-and-the-screenplay-pattern/lessons/29603895-implementing-a-simple-screenplay-scenario and this is really frustrating the hell out of me

globalworming commented 1 year ago

Hard to say without the whole project. I'd suggest you just use https://github.com/serenity-bdd/serenity-cucumber-starter as a start

UltraLas3r commented 1 year ago

That is what I am using. I just cloned that repository and followed the steps in the tutorial I linked in my original post

wakaleo commented 1 year ago

Are you running the scenarios via the runner class or from the feature file itself?

UltraLas3r commented 1 year ago

Are you running the scenarios via the runner class or from the feature file itself?

I have run the tests from every location possible. I do want to say that It is very possible that I am missing something because all of this is new to me. I may be missing something really simple.

When running the test from the feature file I get the same error. Interestingly though, it looks like 2 of my tests are passing and only one is failing image

When running the test from the runner class I am greeted with an ominous warning sign image

When I start the test things seem to work on the first two steps but fail on the third. I probably can figure out the error on the third, but it seems like the issue is deeper than that.

image

Perhaps I am importing things wrong? Java is new to me, and serenity/cucumber/Screenplay Pattern is even newer :D

globalworming commented 1 year ago

can you share your project? what's definitely suspicious is the RunWith annotation on your AuthStepDefinitions. When I look at https://github.com/serenity-bdd/serenity-cucumber-starter/blob/master/src/test/java/starter/stepdefinitions/SearchStepDefinitions.java there is no need for that.

gem-garimakhare commented 1 month ago

I'm also facing this issue with the updated Cucumber runner with Junit5. @wakaleo any resolution for this?

wakaleo commented 1 month ago

Are you trying to run the test from the feature file directly?

gem-garimakhare commented 1 month ago

No @wakaleo . running through runner only

wakaleo commented 1 month ago

Can you provide a same project?