Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Behat with PhpStorm does not show stack trace for exceptions

I've just started using Behat 3.0 with PhpStorm 8.0.

Everything is working fine, except that for exceptions, there is no stack trace shown in PhpStorm. The test just fails with no feedback on where the failure occurred.

If I use Behat in terminal, the stack trace can be seen with the file and line number of the exception.

I have tried running Behat in PhpStorm with --strict and --verbose but still no joy.

It looks like PhpStorm uses its own Behat formatter (PhpStormBehatFormatter) to display the results, so I'm 99% sure the solution will be to modify that (something I think only PhpStorm can do).

Just wanted to check if anyone else had the same issue and if there was a temporary work around?

Note: This is very specific Behat / PhpStorm issue. Unless you know both tools, it's probably best not to answer. Answers such as 'create a custom exception handler' are not going to help.

like image 850
GWed Avatar asked Sep 29 '14 17:09

GWed


People also ask

How do you stack trace?

You can obtain a stack trace from a thread – by calling the getStackTrace method on that Thread instance. This invocation returns an array of StackTraceElement, from which details about stack frames of the thread can be extracted.

How to open stack trace in intellij?

From the main menu, select Code | Analyze Stack Trace or Thread Dump. In the Analyze Stack Trace dialog that opens, paste the external stack trace or thread dump into the Put a stack trace or a complete thread dump here: text area.

How do you analyze stack trace?

From the Analyze menu, click Analyze Stack Trace. Paste the stack trace text into the Analyze Stack Trace window and click OK. Android Studio opens a new <Stacktrace> tab with the stack trace you pasted under the Run window.

What is the stack trace in Java?

The stack trace, also called a backtrace, consists of a collection of stack records, which store an application's movement during its execution. The stack trace includes information about program subroutines and can be used to debug or troubleshoot and is often used to create log files.


2 Answers

So in the 5+ years since this question was asked, PHPStorm has implemented what it has needed, but you still need to know the totally cryptic Behat command-line option, and where to put it. Anyway, this is where desperate Google-searching got me, so let me put the answer here.

Under Run menu, Edit configurations..., select the Behat template, and in the Test Runner options field, put -vv.

Then your Behat fails will the full error message and a stack trace.

like image 193
Tim Hunt Avatar answered Oct 14 '22 00:10

Tim Hunt


Yup, been there, done that… Guys at JetBrains know about this, but no fix version has been set yet. Vote on the issue, this will speed things up.

like image 25
Ian Bytchek Avatar answered Oct 13 '22 23:10

Ian Bytchek