org.scalajs.jsenv.ExternalJSEnv$NonZeroExitException: PhantomJS2 exited with code 2 - scala.js

I am using scalatest as my testing framework, here is my test code :
import org.scalatest.FunSuite
class SampleTest extends FunSuite{
test("hello") {
println(s"sdfsf")
}
}
build.sbt settings
val scalatestJS = libraryDependencies += "org.scalatest" %%% "scalatest" % Version.scalatest % Test
val scalatestJSSettings = Seq(
scalatestJS,
scalaJSStage in Global := FastOptStage,
// scalaJSStage in Global := FullOptStage,
// jsDependencies += RuntimeDOM,
// jsDependencies += ProvidedJS / "test-bundle.js" % Test,
jsEnv in Test := new PhantomJS2Env(scalaJSPhantomJSClassLoader.value, addArgs = Seq("--web-security=no"))
// jsEnv in Test := new NodeJSEnv()
)
Debug out :
[debug] Scala compilation took 0.961938628 s
[debug] Invalidating client/SampleTest.scala...
[debug] Invalidating (transitively) by inheritance from client/SampleTest.scala...
[debug] Initial set of included nodes: Set(client/SampleTest.scala)
[debug] Invalidated by transitive inheritance dependency: Set(client/SampleTest.scala)
[debug] The client/SampleTest.scala source file has the following implicit definitions changed:
[debug] unconstrainedEquality, convertToEqualizer.
[debug] All member reference dependencies will be considered within this context.
[debug] New invalidations:
[debug] Set()
[debug] Initial set of included nodes: Set()
[debug] Previously invalidated, but (transitively) depend on new invalidations:
[debug] Set()
[debug] All newly invalidated sources after taking into account (previously) recompiled sources:Set()
[debug] Copy resource mappings:
[debug]
[info] Fast optimizing client/assets/client-test-fastopt.js
[debug] Linker: Compute reachability: 710892 us
[debug] Linker: Assemble LinkedClasses: 445560 us
[debug] Basic Linking: 1168893 us
[debug] Inc. optimizer: Batch mode: true
[debug] Inc. optimizer: Incremental part: 127681 us
[debug] Inc. optimizer: Optimizing 11793 methods.
[debug] Inc. optimizer: Optimizer part: 5987357 us
[debug] Inc. optimizer: 6140114 us
[debug] Refiner: Compute reachability: 243271 us
[debug] Refiner: Assemble LinkedClasses: 27389 us
[debug] Refiner: 272567 us
[debug] Emitter: Class tree cache stats: reused: 0 -- invalidated: 1375
[debug] Emitter: Method tree cache stats: resued: 0 -- invalidated: 6643
[debug] Emitter (write output): 1353125 us
[debug] Global IR cache stats: reused: 0 -- invalidated: 130 -- trees read: 1748
[debug] Loading JSEnv with linked file client/assets/client-test-fastopt.js
org.scalajs.jsenv.ExternalJSEnv$NonZeroExitException: PhantomJS2 exited with code 2
at org.scalajs.jsenv.ExternalJSEnv$AbstractExtRunner.waitForVM(ExternalJSEnv.scala:107)
at org.scalajs.jsenv.ExternalJSEnv$ExtRunner.run(ExternalJSEnv.scala:156)
at org.scalajs.sbtplugin.FrameworkDetector.detect(FrameworkDetector.scala:66)
at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$60.apply(ScalaJSPluginInternal.scala:737)
at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$60.apply(ScalaJSPluginInternal.scala:720)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:235)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] (client/test:loadedTestFrameworks) org.scalajs.jsenv.ExternalJSEnv$NonZeroExitException: PhantomJS2 exited with code 2
[error] Total time: 15 s, completed May 20, 2016 12:20:29 AM
Note : This is used to work fine but not anymore :s
Edit :
ScalaTest : 3.0.0-M15
ScalaJS : 0.6.9
Scala : 2.11.8
Phantom JS : 2.0.0

In my code i have a class which extends js class
#ScalaJSDefined
class MyLab(container : dom.Node) extends JSLab(container) {... }
even though i am not using this class in my tests,looks like source code generated for this line is some how looking for JSLab in global! which causes crash of phantomjs. Interestingly tests are executing fine on Rhino :s. anyhow i added JSLab as test dependency and error gone.
I don't know whom to blame here , whether its stupid developer(me) who went in different direction while solving problem or scala.js for not helpful in why phantomjs crashed :s

Related

kie-maven-plugin fails to generate model with a mix of Java and DRL facts

I'm trying to generate a fully compiled kmodule with kie-maven-plugin. It works when all facts are defined in DRL, but fails when some facts are defined as Java POJOs.
In the same project:
Java fact (src\main\java\org\example\FactA.java):
package org.example;
public class FactA {
private String propA;
public FactA() { }
public FactA(String propA) {
this.propA = propA;
}
public String getPropA() {
return propA;
}
public void setPropA(String propA) {
this.propA = propA;
}
}
DRL Fact (src\main\resources\org\example\decB.drl):
package org.example
import org.example.FactA
declare FactB
factA: FactA
propB : String
end
POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<generateModel>YES</generateModel>
<runtime.version>7.20.0.Final</runtime.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<groupId>org</groupId>
<artifactId>example</artifactId>
<version>1.0.0</version>
<packaging>kjar</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-bom</artifactId>
<version>${runtime.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-model-compiler</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-canonical-model</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>${runtime.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
Output of mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------------< org:example >-----------------------------
[INFO] Building example 1.0.0
[INFO] --------------------------------[ kjar ]--------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # example ---
[INFO] Deleting C:\Projects\t\kie-maven-plugin-example\target
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # example ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # example ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Projects\t\kie-maven-plugin-example\target\classes
[INFO]
[INFO] --- kie-maven-plugin:7.20.0.Final:generateModel (default-generateModel) # example ---
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-core/7.20.0.Final/drools-core-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.core.io.impl.ResourceFactoryServiceImpl
[INFO] Adding Service org.drools.core.marshalling.impl.MarshallerProviderImpl
[INFO] Adding Service org.drools.core.concurrent.ExecutorProviderImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-compiler/7.20.0.Final/drools-compiler-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.compiler.kie.builder.impl.KieServicesImpl
[INFO] Adding Service org.drools.compiler.builder.impl.KnowledgeBuilderFactoryServiceImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-model-compiler/7.20.0.Final/drools-model-compiler-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.modelcompiler.CanonicalKieModuleProvider
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/kie/kie-internal/7.20.0.Final/kie-internal-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.kie.internal.services.KieAssemblersImpl
[INFO] Adding Service org.kie.internal.services.KieRuntimesImpl
[INFO] Adding Service org.kie.internal.services.KieWeaversImpl
[INFO] Adding Service org.kie.internal.services.KieBeliefsImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-decisiontables/7.20.0.Final/drools-decisiontables-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.decisiontable.DecisionTableProviderImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-scorecards/7.20.0.Final/drools-scorecards-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.scorecards.ScoreCardProviderImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/kie-pmml/7.20.0.Final/kie-pmml-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service +org.kie.pmml.assembler.PMMLAssemblerService
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/jbpm/jbpm-bpmn2/7.20.0.Final/jbpm-bpmn2-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.jbpm.bpmn2.BPMN2ProcessProviderImpl
[INFO] Adding Service org.jbpm.bpmn2.xml.XmlProcessDumperFactoryServiceImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/jbpm/jbpm-flow-builder/7.20.0.Final/jbpm-flow-builder-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.jbpm.process.builder.ProcessBuilderFactoryServiceImpl
[INFO] Adding Service +org.jbpm.assembler.BPMN2AssemblerService
[INFO] Adding Service +org.jbpm.weaver.BPMN2WeaverService
[INFO] Adding Service +org.jbpm.assembler.DRFAssemblerService
[INFO] Adding Service +org.jbpm.weaver.DRFWeaverService
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/jbpm/jbpm-flow/7.20.0.Final/jbpm-flow-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.jbpm.marshalling.impl.ProcessMarshallerFactoryServiceImpl
[INFO] Adding Service org.jbpm.process.instance.ProcessRuntimeFactoryServiceImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/jbpm/jbpm-case-mgmt-cmmn/7.20.0.Final/jbpm-case-mgmt-cmmn-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.jbpm.casemgmt.cmmn.CMMNCaseProviderImpl
[INFO] Adding Service +org.jbpm.casemgmt.cmmn.assembler.CMMNAssemblerService
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-workbench-models-guided-dtable/7.20.0.Final/drools-workbench-models-guided-dtable-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.workbench.models.guided.dtable.backend.GuidedDecisionTableProviderImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-workbench-models-guided-template/7.20.0.Final/drools-workbench-models-guided-template-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.workbench.models.guided.template.backend.GuidedRuleTemplateProviderImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-workbench-models-guided-scorecard/7.20.0.Final/drools-workbench-models-guided-scorecard-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.workbench.models.guided.scorecard.backend.GuidedScoreCardProviderImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/optaplanner/optaplanner-core/7.20.0.Final/optaplanner-core-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service +org.optaplanner.core.impl.solver.kie.KieSolverAssemblerService
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/kie/kie-dmn-core/7.20.0.Final/kie-dmn-core-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service +org.kie.dmn.core.assembler.DMNAssemblerService
[INFO] Adding Service +org.kie.dmn.core.runtime.DMNRuntimeService
[INFO] Adding Service +org.kie.dmn.core.weaver.DMNWeaverService
[INFO] Artifact not fetched from maven: org.drools:drools-bom:${runtime.version}. To enable the KieScanner you need kie-ci on the classpath
[ERROR] package org.example
public class FactB implements org.drools.core.factmodel.GeneratedFact, java.io.Serializable {
public FactB() {
}
public FactB(FactA factA, String propB) {
super();
this.factA = factA;
this.propB = propB;
}
#org.kie.api.definition.type.Position(value = 0)
private FactA factA;
public void setFactA(FactA factA) {
this.factA = factA;
}
public FactA getFactA() {
return factA;
}
#org.kie.api.definition.type.Position(value = 1)
private String propB;
public void setPropB(String propB) {
this.propB = propB;
}
public String getPropB() {
return propB;
}
#Override()
public String toString() {
return "FactB" + "( " + "factA=" + factA + ", " + "propB=" + propB + " )";
}
}
[ERROR] Unable to build KieBaseModel:defaultKieBase
CompilationProblemErrorResult: cannot find symbol
symbol: class FactA
location: package org.example
CompilationProblemErrorResult: cannot find symbol
symbol: class FactA
location: class org.example.FactB
CompilationProblemErrorResult: cannot find symbol
symbol: class FactA
location: class org.example.FactB
CompilationProblemErrorResult: cannot find symbol
symbol: class FactA
location: class org.example.FactB
CompilationProblemErrorResult: cannot find symbol
symbol: class FactA
location: class org.example.FactB
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.465 s
[INFO] Finished at: 2019-04-26T09:00:16-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.20.0.Final:generateModel (default-generateModel) on project example: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.20.0.Final:generateModel failed: Unable to get KieModule, Errors Existed: Error Messages:
[ERROR] Message [id=1, kieBase=defaultKieBase, level=ERROR, path=null, line=5, column=0
[ERROR] text=cannot find symbol
[ERROR] symbol: class FactA
[ERROR] location: package org.example]
[ERROR] Message [id=2, kieBase=defaultKieBase, level=ERROR, path=null, line=12, column=0
[ERROR] text=cannot find symbol
[ERROR] symbol: class FactA
[ERROR] location: class org.example.FactB]
[ERROR] Message [id=3, kieBase=defaultKieBase, level=ERROR, path=null, line=19, column=0
[ERROR] text=cannot find symbol
[ERROR] symbol: class FactA
[ERROR] location: class org.example.FactB]
[ERROR] Message [id=4, kieBase=defaultKieBase, level=ERROR, path=null, line=21, column=0
[ERROR] text=cannot find symbol
[ERROR] symbol: class FactA
[ERROR] location: class org.example.FactB]
[ERROR] Message [id=5, kieBase=defaultKieBase, level=ERROR, path=null, line=25, column=0
[ERROR] text=cannot find symbol
[ERROR] symbol: class FactA
[ERROR] location: class org.example.FactB]
[ERROR] ---
[ERROR] Warning Messages:
[ERROR] ---
[ERROR] Info Messages:
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
It's probably a bug in the generation of declared types with the executable model.
Can you kindly post your reproducer here?
https://issues.jboss.org/projects/DROOLS/issues
In the meanwhile, as a workaround, can you try use the fully qualified name while using the class in the declared type?
package org.example
declare FactB
factA: org.example.FactA
propB : String
end
I've tried this against current master and it works.
Thanks for your help
It was a bug fixed here
https://github.com/kiegroup/drools/commit/c36f3ebf1f02e54742c8b4056e7b64bb5deaed07
Thanks for reporting

#Karate Gatling is not generating report when i hit the endpoint once

My Gatling Simulation class,
class <MyClass> extends Simulation {
before {
println("Simulation is about to start!")
}
val smapleTest = scenario("test").exec(karateFeature("classpath:demo/get-user.feature"))
setUp(
smapleTest.inject(rampUsers(1) over (10 seconds))).maxDuration(1 minutes)
//).assertions(global.responseTime.mean.lt(35))
after {
println("Simulation is finished!")
}
}
My get-user.feature file,
Scenario Outline: Hit wskadmin url
Given http://172.17.0.1:5984/whisk_local_subjects/guest
And header Authorization = AdminAuth
And header Content-Type = 'application/json'
When method get
Then status <stat>
* print result
Examples:
| stat |
| 200 |
When i run the simulation class, below console logs i am getting:
Simulation com.karate.openwhisk.performance.SmokePerformanceTest started...
13:20:48.877 [GatlingSystem-akka.actor.default-dispatcher-5] INFO i.gatling.core.controller.Controller - InjectionStopped expectedCount=1
13:20:49.473 [GatlingSystem-akka.actor.default-dispatcher-4] INFO com.intuit.karate - karate.env system property was: null
13:20:49.525 [GatlingSystem-akka.actor.default-dispatcher-7] INFO com.intuit.karate - [print] I am here in get-user
13:20:49.706 [GatlingSystem-akka.actor.default-dispatcher-4] DEBUG com.intuit.karate - request:
1 > GET http://172.17.0.1:5984/whisk_local_subjects/guest
1 > Accept-Encoding: gzip,deflate
1 > Authorization: Basic d2hpc2tfYWRtaW46c29tZV9wYXNzdzByZA==
1 > Connection: Keep-Alive
1 > Content-Type: application/json
1 > Host: 172.17.0.1:5984
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_144)
13:20:49.741 [GatlingSystem-akka.actor.default-dispatcher-4] DEBUG com.intuit.karate - response time in milliseconds: 34
1 < 200
Note: Here i am getting the response in 34 mili seconds, but gating is unable to generate the report. Below is the error message i am getting
Error:
Generating reports...
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Caused by: java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated
at io.gatling.charts.report.ReportsGenerator.generateFor(ReportsGenerator.scala:48)
at io.gatling.app.RunResultProcessor.generateReports(RunResultProcessor.scala:76)
at io.gatling.app.RunResultProcessor.processRunResult(RunResultProcessor.scala:55)
at io.gatling.app.Gatling$.start(Gatling.scala:68)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:45)
at io.gatling.app.Gatling$.main(Gatling.scala:37)
at io.gatling.app.Gatling.main(Gatling.scala)
... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.199 s
[INFO] Finished at: 2018-07-24T13:20:50+05:30
[INFO] Final Memory: 30M/332M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.gatling:gatling-maven-plugin:2.2.4:test (default-cli) on project
openwhisk: Gatling failed.: Process exited with an error: 255 (Exit
value: 255) -> [Help 1]
But if i run the same simulation file simple change in feature file as below
Scenario Outline: Hit wskadmin url
Given http://172.17.0.1:5984/whisk_local_subjects/guest
And header Authorization = AdminAuth
And header Content-Type = 'application/json'
When method get
Then status <stat>
* print result
Examples:
| stat |
| 200 |
| 200 |
Then gatling generates the report.
Please help me someone what is the root cause.
Thank you for your interest in karate-gatling and the very detailed report.
This is a bug, which we have fixed and just made a release for.
Can you upgrade your karate-gatling version to 0.8.0.1 and let me know how it goes ?

ScalaTest DeferredAbortedSuite error when running simple tests.

My original code had a lot more going on, which distracted me from the true cause of the problem.
This captures the essential problem.
import org.scalatest.AsyncFlatSpec
import scala.concurrent.Future
class AsyncFlatSpecSpec extends AsyncFlatSpec
{
it should "parse an XML file" in {
// ... Parsing ...
Future.successful(succeed)
}
it should "parse an XML file" in {
// ... Serializing ...
Future.successful(succeed)
}
}
This produced these errors:
[info] DeferredAbortedSuite:
[error] Uncaught exception when running AsyncFlatSpecSpec: java.lang.ArrayIndexOutOfBoundsException: 17
[trace] Stack trace suppressed: run last test:testOnly for the full output.
There is no array access happening anywhere in my code. What's going on?
Running "last test:testOnly" wasn't much help:
[info] DeferredAbortedSuite:
[error] Uncaught exception when running AsyncFlatSpecSpec: java.lang.ArrayIndexOutOfBoundsException: 17
sbt.ForkMain$ForkError: java.lang.ArrayIndexOutOfBoundsException: 17
at org.scalatest.exceptions.StackDepth$class.stackTraceElement(StackDepth.scala:63)
at org.scalatest.exceptions.StackDepth$class.failedCodeFileName(StackDepth.scala:77)
at org.scalatest.exceptions.StackDepthException.failedCodeFileName(StackDepthException.scala:36)
at org.scalatest.exceptions.StackDepth$class.failedCodeFileNameAndLineNumberString(StackDepth.scala:59)
at org.scalatest.exceptions.StackDepthException.failedCodeFileNameAndLineNumberString(StackDepthException.scala:36)
at org.scalatest.tools.StringReporter$.withPossibleLineNumber(StringReporter.scala:442)
at org.scalatest.tools.StringReporter$.stringsToPrintOnError(StringReporter.scala:916)
at org.scalatest.tools.StringReporter$.fragmentsForEvent(StringReporter.scala:747)
at org.scalatest.tools.Framework$SbtLogInfoReporter.apply(Framework.scala:622)
at org.scalatest.tools.FilterReporter.apply(FilterReporter.scala:41)
at org.scalatest.tools.SbtDispatchReporter$$anonfun$apply$1.apply(SbtDispatchReporter.scala:23)
at org.scalatest.tools.SbtDispatchReporter$$anonfun$apply$1.apply(SbtDispatchReporter.scala:23)
at scala.collection.Iterator$class.foreach(Iterator.scala:893)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at org.scalatest.tools.SbtDispatchReporter.apply(SbtDispatchReporter.scala:23)
at org.scalatest.tools.Framework$SbtReporter.apply(Framework.scala:1119)
at org.scalatest.tools.Framework.org$scalatest$tools$Framework$$runSuite(Framework.scala:387)
at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:506)
at sbt.ForkMain$Run$2.call(ForkMain.java:296)
at sbt.ForkMain$Run$2.call(ForkMain.java:286)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Confused, I retreated to the non-Async version, to see if that fared any
better.
import org.scalatest.FlatSpec
class FlatSpecSpec extends FlatSpec {
it should "parse an XML file" in {
// ... Parsing ...
succeed
}
it should "parse an XML file" in {
// ... Serializing ...
succeed
}
}
It produced this different, but still cryptic error message:
[info] DeferredAbortedSuite:
[info] Exception encountered when attempting to run a suite with class name: org.scalatest.DeferredAbortedSuite *** ABORTED *** (20 milliseconds)
[info] Exception encountered when attempting to run a suite with class name: org.scalatest.DeferredAbortedSuite (AsyncFlatSpecSpec.scala:32)
[info] ScalaTest
For completeness, here are the related portions of my build.sbt:
scalaVersion := "2.11.8"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0-M15" % "test"
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.0-M15"
This was ultimately a trivial mistake on my part, but I wanted to post this for the sake of anyone else Googling these errors.
As many readers probably noticed while going through the examples, the problem was that I had copy/pasted the same test description.
This allows the code to compile, but will fail at runtime with errors that
don't identify the description as the culprit.
Stupid error on my part, but it would be nice if the compiler reported it in a more helpful way.

Why does sbt fail to resolve spongeapi dependency that gradle can find fine?

I'm getting the following error when attempting to build a project that has previously built fine.
Error:Error while importing SBT project:
...
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:235)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] sbt.ResolveException: unresolved dependency: org.spongepowered#spongeapi;2.1-SNAPSHOT: not found
[error] Use 'last' for the full log.
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0
See complete log in C:\Users\Ryan\.IntelliJIdea14\system\log\sbt.last.log
build.sbt
name := "MemoryStones"
version := "1.0"
scalaVersion := "2.11.7"
resolvers += "sponge-repo1" at "http://repo.spongepowered.org/maven"
resolvers += Resolver.sonatypeRepo("snapshots")
resolvers += "sonatypeReleases" at "http://oss.sonatype.org/content/repositories/releases/"
libraryDependencies += "org.spongepowered" % "spongeapi" % "2.1-SNAPSHOT"
libraryDependencies += "com.typesafe" % "config" % "1.2.1"
libraryDependencies += "org.scala-lang.modules" % "scala-java8-compat_2.11" % "0.7.0"
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4"
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)
However, using the same dependency on a java/gradle project works fine without error, and the dependency resolves fine.
build.gradle
group 'au.id.rleach'
version '0.1-SNAPSHOT'
apply plugin: 'java'
sourceCompatibility = 1.8
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
compile 'org.spongepowered:spongeapi:2.1-SNAPSHOT'
}
repositories {
mavenCentral()
maven {
name = 'sponge'
url = 'http://repo.spongepowered.org/maven'
}
}
I wasn't able to reproduce this issue using sbt 0.13.9.
$ sbt
MemoryStones> update
[info] Updating {file:/Users/eugene/work/quick-test/so-34368203/}so-34368203...
[info] Resolving jline#jline;2.12.1 ...
[info] downloading http://repo.spongepowered.org/maven/org/spongepowered/spongeapi/2.1-SNAPSHOT/spongeapi-2.1-20151219.052344-209.jar ...
[info] [SUCCESSFUL ] org.spongepowered#spongeapi;2.1-SNAPSHOT!spongeapi.jar (1545ms)
[info] downloading https://jcenter.bintray.com/org/scala-lang/modules/scala-java8-compat_2.11/0.7.0/scala-java8-compat_2.11-0.7.0.jar ...
[info] [SUCCESSFUL ] org.scala-lang.modules#scala-java8-compat_2.11;0.7.0!scala-java8-compat_2.11.jar(bundle) (2043ms)
[info] downloading https://jcenter.bintray.com/com/flowpowered/flow-math/1.0.1/flow-math-1.0.1.jar ...
[info] [SUCCESSFUL ] com.flowpowered#flow-math;1.0.1!flow-math.jar (671ms)
[info] downloading https://jcenter.bintray.com/ninja/leaping/configurate/configurate-yaml/3.1/configurate-yaml-3.1.jar ...
[info] [SUCCESSFUL ] ninja.leaping.configurate#configurate-yaml;3.1!configurate-yaml.jar (399ms)
[info] downloading https://jcenter.bintray.com/ninja/leaping/configurate/configurate-gson/3.1/configurate-gson-3.1.jar ...
[info] [SUCCESSFUL ] ninja.leaping.configurate#configurate-gson;3.1!configurate-gson.jar (403ms)
[info] downloading https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.13/slf4j-api-1.7.13.jar ...
[info] [SUCCESSFUL ] org.slf4j#slf4j-api;1.7.13!slf4j-api.jar (381ms)
[info] downloading http://repo.spongepowered.org/maven/com/flowpowered/flow-noise/1.0.1-SNAPSHOT/flow-noise-1.0.1-20150609.030116-1.jar ...
[info] [SUCCESSFUL ] com.flowpowered#flow-noise;1.0.1-SNAPSHOT!flow-noise.jar (325ms)
[info] downloading http://repo.spongepowered.org/maven/org/spongepowered/event-gen-core/0.10-SNAPSHOT/event-gen-core-0.10-20151125.161414-1.jar ...
[info] [SUCCESSFUL ] org.spongepowered#event-gen-core;0.10-SNAPSHOT!event-gen-core.jar (316ms)
[info] downloading https://jcenter.bintray.com/ninja/leaping/configurate/configurate-hocon/3.1/configurate-hocon-3.1.jar ...
[info] [SUCCESSFUL ] ninja.leaping.configurate#configurate-hocon;3.1!configurate-hocon.jar (409ms)
[info] downloading https://jcenter.bintray.com/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar ...
[info] [SUCCESSFUL ] org.yaml#snakeyaml;1.16!snakeyaml.jar(bundle) (1447ms)
[info] downloading https://jcenter.bintray.com/ninja/leaping/configurate/configurate-core/3.1/configurate-core-3.1.jar ...
[info] [SUCCESSFUL ] ninja.leaping.configurate#configurate-core;3.1!configurate-core.jar (597ms)
[info] Done updating.
[success] Total time: 40 s, completed Dec 19, 2015 2:10:36 AM
The only change I made from your build file was commenting out the last line since you didn't specify to use sbt-assembly.

Why does scalatest mix up the output?

I run my scalatest from sbt, and the output gets mixed up - scalatest prints all the test run, and comments to them, and somewhere in the middle it prints the statistics:
> test
[info] Compiling 1 Scala source to /home/platon/Tor/scala-dojo-02/target/scala-2.9.1/classes...
[info] FunsWithListsTests:
[info] - should return list of labels
[info] - should return the average rating of games belonging to Zenga
[info] - should return the total ratings of all games
[info] - should return the total ratings of EA games *** FAILED ***
[info] 0 did not equal 170 (FunsWithListsTests.scala:35)
[error] Failed: : Total 8, Failed 5, Errors 0, Passed 3, Skipped 0
[info] - should increase all games rating by 10 *** FAILED ***
[error] Failed tests:
[error] dojo.FunsWithListsTests
[info] List() did not equal List(Game(Activision,40), Game(Zenga,70), Game(Zenga,20), Game(EA,70), Game(EA,120)) (FunsWithListsTests.scala:40)
[info] - should decrease all Zenga games rating by 10 *** FAILED ***
[info] List() did not equal List(Game(Activision,30), Game(Zenga,50), Game(Zenga,0), Game(EA,60), Game(EA,110)) (FunsWithListsTests.scala:45)
[info] - should create function to find Activision games *** FAILED ***
[info] List(Game(Activision,30), Game(Zenga,60), Game(Zenga,10), Game(EA,60), Game(EA,110)) did not equal List(Game(Activision,30)) (FunsWithListsTests.scala:50)
[info] - should return a List of tuples consisting of game label and game *** FAILED ***
[info] List() did not equal List((ACTIVISION,Game(Activision,30)), (ZENGA,Game(Zenga,60)), (ZENGA,Game(Zenga,10)), (EA,Game(EA,60)), (EA,Game(EA,110))) (FunsWithListsTests.scala:56)
[error] {file:/home/platon/Tor/scala-dojo-02/}default-940f03/test:test: Tests unsuccessful
[error] Total time: 1 s, completed Mar 20, 2012 9:27:13 AM
It seems that if I would accumulate a great number of tests, searching for those stats and failed tests would become a pain.
Is there a way to fix this?
It looks to me the reason for that is that SBT by default executes the tests in parallel, the same way maven-surefire-plugin does.
As it is explained in ScalaTest wiki, this can be solved by:
Disable Parallel Execution of Tests
By default, sbt runs all tasks in parallel. Because each test is mapped to a task, tests are also run in parallel by default. To disable parallel execution of tests:
parallelExecution in Test := false
Have the same issue and solved it by saving logs into separate files. Not ideal, but good for CI, especially in case of long-running integration tests. How I did it:
Create a special directory for logs (for example, at the end of build.sbt):
lazy val logDirectory = taskKey[File]("A directory for logs")
logDirectory := {
val r = target.value / "logs"
IO.createDirectory(r)
r
}
[Optionally] Specify a file for a summary information in a project:
testOptions in test += Tests.Argument(
TestFrameworks.ScalaTest, "-fW", (logDirectory.value / "summary.log").toString
)
W disables colors
Create a group for each test. Each group must run a test in a forked JVM with special arguments:
testGrouping in test := testGrouping.value.flatMap { group =>
group.tests.map { suite =>
val fileName = {
// foo.bar.baz.TestSuite -> f.b.b.TestSuite
val parts = suite.name.split('.')
(parts.init.map(_.substring(0, 1)) :+ parts.last).mkString(".")
}
val forkOptions = ForkOptions(
bootJars = Nil,
javaHome = javaHome.value,
connectInput = connectInput.value,
outputStrategy = outputStrategy.value,
runJVMOptions = javaOptions.value ++ Seq(
"-Dour.logging.appender=FILE",
s"-Dour.logging.dir=${logDirectory.value / fileName}"
),
workingDirectory = Some(baseDirectory.value),
envVars = envVars.value
)
group.copy(
name = suite.name,
runPolicy = Tests.SubProcess(forkOptions),
tests = Seq(suite)
)
}
}
Note, we can tell the logback, where we save our logs through our.logging.appender and our.logging.dir
Create a configuration for logging (test/resources/logback-test.xml):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<target>System.out</target>
<encoder>
<pattern>%date{yyyy-MM-dd HH:mm:ss} %-5level [%thread] %logger{26} - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${our.logging.dir}/test.log</file>
<append>false</append>
<encoder>
<pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{26} - %msg%n</pattern>
</encoder>
</appender>
<root level="TRACE">
<appender-ref ref="${our.logging.appender}"/>
</root>
</configuration>
That's all.