You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a controller method throws an unhandled exception, under normal circumstances this leads to 500 error page. However if I make request to the same method from the functional test, I get a 200 OK response.
This really breaks my functional testing, as my tests can not catch a bug which can be easily seen if opening the page manually in a browser.
To get my error I need either to use selenium test (which is slow, but it gets same result as a browser) or to wrap controller method into:
try { ... } catch (Exception ex) { error() }
In case of explicit error() call the functional test gets correct 500 return code.
When a controller method throws an unhandled exception, under normal circumstances this leads to 500 error page. However if I make request to the same method from the functional test, I get a 200 OK response.
This really breaks my functional testing, as my tests can not catch a bug which can be easily seen if opening the page manually in a browser.
To get my error I need either to use selenium test (which is slow, but it gets same result as a browser) or to wrap controller method into:
try { ... } catch (Exception ex) { error() }
In case of explicit error() call the functional test gets correct 500 return code.
I created a sample webapp, where Application.index() method throws a runtime exception and a functional test checks that its return status is 500:
https://drive.google.com/file/d/0B72ZMlJTpA1VLWxpd0lMWk5JSHM/view?usp=sharing
The text was updated successfully, but these errors were encountered: