sbt-cucumber icon indicating copy to clipboard operation
sbt-cucumber copied to clipboard

java.lang.IllegalStateException if any of the JUnit Assertions failing

Open surajitd82 opened this issue 3 years ago • 0 comments

Hi,

I am have written some cucumber scenarios and added junit assertions in the steps. If any of the assertions fail, the cucumber report comes with step failure, but cucumber plugin also throws following error.

[error] java.lang.IllegalStateException: Cucumber did not succeed and returned error =1 [error] at com.waioeka.sbt.CucumberPlugin$.$anonfun$projectSettings$6(CucumberPlugin.scala:116) [error] at com.waioeka.sbt.CucumberPlugin$.$anonfun$projectSettings$6$adapted(CucumberPlugin.scala:91) [error] at scala.Function1.$anonfun$compose$1(Function1.scala:44) [error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39) [error] at sbt.std.Transform$$anon$4.work(System.scala:66) [error] at sbt.Execute.$anonfun$submit$2(Execute.scala:262) [error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16) [error] at sbt.Execute.work(Execute.scala:271)

Following are the sbt changes..

Plugin Dependencies added: addSbtPlugin("com.waioeka.sbt" % "cucumber-plugin" % "0.3.0")

lazy val qaDependencies = Seq( "io.cucumber" % "cucumber-core" % "6.10.4" % "test", "io.cucumber" %% "cucumber-scala" % "6.10.4" % "test", "io.cucumber" % "cucumber-jvm" % "6.10.4" % "test", "io.cucumber" % "cucumber-junit" % "6.10.4" % "test", "io.cucumber" % "cucumber-java" % "6.10.4"% "test", "org.scalatest" %% "scalatest" % "3.0.5" % "test", "junit" % "junit" % "4.12" % "test")

lazy val testPro= project .settings(name := "testPro") .settings(libraryDependencies ++= qaDependencies) .settings(crossPaths :=false) .enablePlugins(CucumberPlugin) .settings(CucumberPlugin.glues := List("com.waioeka.sbt")) .settings(CucumberPlugin.envProperties := Map("cucumber.execution.strict"->"true"))

Any help on how to resolve this. This is causing the jenkins builds to go on error always if there is any assertion failure.

surajitd82 avatar Jul 07 '21 10:07 surajitd82