gauge-java
gauge-java copied to clipboard
The stacktrace available in the Execution Context should be complete
Expected behavior The complete stacktrace is available
Actual behavior The stacktrace available is truncated.
Steps to replicate
- Create a
gauge-java
project - Throw an exception in a step
The stacktrace in Execution context is not complete
Version
Gauge version: 0.9.8.nightly-2018-04-19
Commit Hash: 58298e2
Plugins
-------
java (0.6.7.nightly-2018-04-16)
Related to https://github.com/getgauge/gauge-java/issues/125
can you post a truncated stacktrace ?
I get
# Specification Heading
## Vowel counts in single word P F
Failed Step: The word "gauge" has "3" vowels.
Specification: specs\example.spec:16
Error Message: java.lang.NullPointerException: This is wrong
Stacktrace:
StepImplementation.verifyVowelsCountInWord(StepImplementation.java:24)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.base/java.lang.reflect.Method.invoke(Method.java:564)
com.thoughtworks.gauge.execution.MethodExecutor.execute(MethodExecutor.java:38)
com.thoughtworks.gauge.execution.StepExecutionStage.executeStepMethod(StepExecutionStage.java:74)
com.thoughtworks.gauge.execution.StepExecutionStage.executeStep(StepExecutionStage.java:67)
com.thoughtworks.gauge.execution.StepExecutionStage.execute(StepExecutionStage.java:49)
com.thoughtworks.gauge.execution.AbstractExecutionStage.executeNext(AbstractExecutionStage.java:24)
com.thoughtworks.gauge.execution.HookExecutionStage.execute(HookExecutionStage.java:43)
com.thoughtworks.gauge.execution.ExecutionPipeline.start(ExecutionPipeline.java:29)
com.thoughtworks.gauge.processor.ExecuteStepProcessor.process(ExecuteStepProcessor.java:45)
com.thoughtworks.gauge.connection.MessageDispatcher.dispatchMessages(MessageDispatcher.java:92)
com.thoughtworks.gauge.GaugeRuntime.dispatchMessages(GaugeRuntime.java:96)
com.thoughtworks.gauge.GaugeRuntime.lambda$connectSynchronously$1(GaugeRuntime.java:79)
java.base/java.lang.Thread.run(Thread.java:844)
## Vowel counts in multiple word P P
Successfully generated html-report to => C:\Users\ajoecker\dev\gauge-init-java\reports\html-report\index.html
Specifications: 1 executed 0 passed 1 failed 0 skipped
Scenarios: 2 executed 1 passed 1 failed 0 skipped
Total time taken: 566ms
which looks fine ?!
Version
$ gauge -v
Gauge version: 0.9.7
Commit Hash: bc9784c
Plugins
-------
html-report (4.0.3)
java (0.6.7.nightly-2018-04-27)
screenshot (0.0.1)
spectacle (0.1.2)
We decided to leave the stacktrace as is (that is in its truncated form). The reason being, the user in most of the cases should be worrying about the internals of Gauge and will not need Gauge's stacktrace. If someone sees a need for this, please feel free to comment and tell us why you would need this kind of stacktrace.
The information that I'm missing are nested exceptions. It's OK not to show that information in the regular Gauge output, but there should be an easy way to get as much exception information as possible when things start to get complicated.
My suggestion is to include a reference to the top level Throwable
in the StepDetails
object pased via the ExecutionContext
of an @AfterStep
method. This way the tester will be able to format the exception at his/her convenience.
Ref. #189.
What's missing is not Gauge's stacktrace but the caused by of the exception that does get logged. The output I'm looking at is equivalent to this:
Failed Step: The word "gauge" has "3" vowels.
Specification: specs\example.spec:16
Error Message: java.lang.ExceptionInInitializerError
Stacktrace:
StepImplementation.verifyVowelsCountInWord(StepImplementation.java:24)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.base/java.lang.reflect.Method.invoke(Method.java:564)
com.thoughtworks.gauge.execution.MethodExecutor.execute(MethodExecutor.java:38)
com.thoughtworks.gauge.execution.StepExecutionStage.executeStepMethod(StepExecutionStage.java:74)
com.thoughtworks.gauge.execution.StepExecutionStage.executeStep(StepExecutionStage.java:67)
com.thoughtworks.gauge.execution.StepExecutionStage.execute(StepExecutionStage.java:49)
com.thoughtworks.gauge.execution.AbstractExecutionStage.executeNext(AbstractExecutionStage.java:24)
com.thoughtworks.gauge.execution.HookExecutionStage.execute(HookExecutionStage.java:43)
com.thoughtworks.gauge.execution.ExecutionPipeline.start(ExecutionPipeline.java:29)
com.thoughtworks.gauge.processor.ExecuteStepProcessor.process(ExecuteStepProcessor.java:45)
com.thoughtworks.gauge.connection.MessageDispatcher.dispatchMessages(MessageDispatcher.java:92)
com.thoughtworks.gauge.GaugeRuntime.dispatchMessages(GaugeRuntime.java:96)
com.thoughtworks.gauge.GaugeRuntime.lambda$connectSynchronously$1(GaugeRuntime.java:79)
java.base/java.lang.Thread.run(Thread.java:844)
What caused the ExceptionInInitializerError? There isn't a way to tell here.
The "caused by" and the suppressed exceptions should be logged too.