sbt / sbt-cucumber

Cucumber plugin for SBT.
Other
20 stars 14 forks source link

can't run sbt cucumber when I have sbt-jacoco #1

Open kieranbop opened 6 years ago

kieranbop commented 6 years ago

I'm running jacoco as my coverage tool as part of my unit tests and that runs fine. When I then try and run my seperate cucumber tests sbt cucumber I am being returned the following error: error] Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 [error] Apr 04, 2018 2:20:33 PM com.capitalone.integration.steps.StepDefinitions_Then $jacocoInit [error] INFO: 725cd0a7 [error] Exception in thread "main" java.lang.ClassCastException: java.lang.Long cannot be cast to [Z [error] at com.capitalone.integration.steps.StepDefinitions_Then.$jacocoInit(StepDefinitions_Then.scala) [error] at com.capitalone.integration.steps.StepDefinitions_Then.<init>(StepDefinitions_Then.scala) [error] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [error] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [error] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [error] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [error] at java.lang.Class.newInstance(Class.java:442) [error] at cucumber.runtime.scala.ScalaBackend$$anonfun$6.apply(ScalaBackend.scala:62) [error] at cucumber.runtime.scala.ScalaBackend$$anonfun$6.apply(ScalaBackend.scala:62) [error] at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245) [error] at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245) [error] at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) [error] at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48) [error] at scala.collection.TraversableLike$class.map(TraversableLike.scala:245) [error] at scala.collection.AbstractTraversable.map(Traversable.scala:104) [error] at cucumber.runtime.scala.ScalaBackend.loadGlue(ScalaBackend.scala:62) [error] at cucumber.runtime.Runtime.<init>(Runtime.java:91) [error] at cucumber.runtime.Runtime.<init>(Runtime.java:69) [error] at cucumber.runtime.Runtime.<init>(Runtime.java:65) [error] at cucumber.api.cli.Main.run(Main.java:35) [error] at cucumber.api.cli.Main.main(Main.java:18)

I have tried disabling the plugin, but as I am running 'sbt cucumber' it doesn't seem to be excluding for me correctly. The disabling part of my build.sbt is below.

lazy val integration = (project in file("testing/integration"))
  .enablePlugins(CucumberPlugin)
  .disablePlugins(JacocoItPlugin)
  .settings(commonSettings: _*)
  .settings(commonDependencies: _*)
  .settings(integrationSettings: _*)
  .settings(cucumberSettings: _*)
  .settings(
    name := "DATAGOVINT"
  )
  .dependsOn(development)

Is there any way around excluding coverage tools from running with the cucumber command or do I need to run the cucumber tests differently?

addSbtPlugin("com.waioeka.sbt" % "cucumber-plugin" % "0.1.6")
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.0.3")

^^ plugin versions

lewismj commented 6 years ago

I should have some spare time to investigate this evening... I'll take a look a bit later and see if I can reproduce, the plugin is due a new version shortly...

kieranbop commented 6 years ago

sounds promising, let me know if you need anything further.

VitaliKrasnik commented 6 years ago

Try change .disablePlugins(JacocoItPlugin) to .disablePlugins(JacocoPlugin) Will look like this lazy val integration = (project in file("testing/integration")) .enablePlugins(CucumberPlugin) .disablePlugins(JacocoPlugin) .settings(commonSettings: *) .settings(commonDependencies: ) .settings(integrationSettings: _) .settings(cucumberSettings: _*) .settings( name := "DATAGOVINT" ) .dependsOn(development)

kieranbop commented 6 years ago

Hey Vitali, thanks for that. I have tried the above and come back with the following errors: [error] Runtime references to undefined settings: [error] [error] integration/test:jacocoExcludes from root/test:jacocoAggregateReport ((com.github.sbt.jacoco.BaseJacocoPlugin) BaseJacocoPlugin.scala:88) [error] [error] integration/test:jacocoIncludes from root/test:jacocoAggregateReport ((com.github.sbt.jacoco.BaseJacocoPlugin) BaseJacocoPlugin.scala:88) [error] [error] integration/test:jacocoExcludes from root/test:jacocoAggregateReport ((com.github.sbt.jacoco.BaseJacocoPlugin) BaseJacocoPlugin.scala:88) [error] [error] integration/test:jacocoIncludes from root/test:jacocoAggregateReport ((com.github.sbt.jacoco.BaseJacocoPlugin) BaseJacocoPlugin.scala:88) [error]

I have also tried to import importing import com.github.sbt.jacoco.JacocoPlugin import com.github.sbt.jacoco.BaseJacocoPlugin etc to try and resolve the issue but I face similar issues.

fabianedl777 commented 5 years ago

any progress?

kieranbop commented 5 years ago

unfortunately not :(

lewismj commented 5 years ago

apologies, I updated the cucumber project (busy at work) a couple of days ago. I've only ever tested this with scoverage plugin, will try to take a look soon...