Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringIndexOutOfBoundsException while using serenity-cucumber5 with Scala #2152

Closed
nikhilKaushal4 opened this issue Jul 5, 2020 · 2 comments

Comments

@nikhilKaushal4
Copy link

nikhilKaushal4 commented Jul 5, 2020

Hi,
I am using serenity-cucumber5 with Scala.
My step definition is:
import io.cucumber.scala.{EN, ScalaDsl} class ScalaSteps extends EN with ScalaDsl { Given("test scala print something") { () => print(s"In Scala printing") } }

When I run my test I am getting
java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1967) at net.serenitybdd.cucumber.util.StepDefinitionAnnotationReader.className(StepDefinitionAnnotationReader.java:76)

Caused by StepDefinitionAnnotationReader class (line 75)
stepDefinitionPath value is 'ScalaSteps.scala:6' and there is no '(' so it is throwing exception.

Is there a way to skip/override the getScreenshotPreferences method
or do we have any other workaround so that I can use serenity-cucumber5 with Scala.

Note - the same scenario is working with serenity-cucumber4

@wakaleo
Copy link
Member

wakaleo commented Jul 5, 2020

Your best option is to propose a PR to cater for this case.

@nikhilKaushal4
Copy link
Author

Hi,
Sorry for the delay.
I have created a PR that works fine with Java and Scala.
Please have a look.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants