Beautiful Failures at 33rd Degree

33rd in Kraków, is rolling baby.Tomorrow, together with Maciek Próchniak, we are giving a talk about failures. There is a problem with failures withing our culture, and by our, I mean central and eastern Europe. In San Fransisco, there are regular meetings, called Mobile Monday, where speakers start by saying how many start ups they have failed, and it’s been seen as a their reference to wisdom. At the very end, they’ve learned a lot from all this failures. And it’s not limited only to San Francisco or Mobile Monday. It’s their culture, every failure gets you smarter. In US it’s OK to fail. Have you heard a story about a Japanese train controller that committed suicide, when two trains in a row have been late because of his mistakes? The Europe may not be that extreme, but it’s still at least inappropriate to admit, that you ever made a mistake. If we never admit, if we never reflect, we never learn. So we are changing the rules for an hour. There is nothing good or bad without a context, and we would like to share the circumstances under which things don’t work. Things like:

  • shared responsibility
  • self organized teams
  • gamification
  • open source
  • metaprogramming
  • ‘enterprise’ technologies

See yoy there.

You May Also Like

Grails with Spock unit test + IntelliJ IDEA = No thread-bound request found

During my work with Grails project using Spock test in IntelliJ IDEA I've encountered this error:

java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131)
at org.codehaus.groovy.grails.plugins.web.api.CommonWebApi.currentRequestAttributes(CommonWebApi.java:205)
at org.codehaus.groovy.grails.plugins.web.api.CommonWebApi.getParams(CommonWebApi.java:65)
... // and few more lines of stacktrace ;)

It occurred when I tried to debug one of test from IDEA level. What is interesting, this error does not happen when I'm running all test using grails test-app for instance.

So what was the issue? With little of reading and tip from Tomek Kalkosiński (http://refaktor.blogspot.com/) it turned out that our test was missing @TestFor annotation and adding it solved all problems.

This annotation, according to Grails docs (link), indicates Spock what class is being tested and implicitly creates field with given type in test class. It is somehow strange as problematic test had explicitly and "manually" created field with proper controller type. Maybe there is a problem with mocking servlet requests?