Play! is enticing because it offers a whole-stack approach to web application development. It provides an environment for managing, writing, building, testing, and running the application. Further, it is able to generate project files for popular IDEs including Eclipse and IntelliJ Idea. Out of the box, Play! includes built-in support for templated views, databases, unit-testing, browser-based testing, and much more.
I used Eclipse to edit the code and run the unit tests, and, in addition to the common and relatively well-documented problems (like Ebean complaints about enhanced vs. non-enhanced model classes), I quickly found that some of the tests ran differently inside Eclipse than they did when run from the Play! console. I noticed three distinct categories of these failures:
- Calling update on an Ebean model class failed to update the database in tests run from within Eclipse.
- Instantiating an object from data in an HTML form post using Play!'s form data binding infrastructure failed to properly configure the new object in tests run from within Eclipse.
In each of these instances, the tests would pass when run from the Play! console. The code and the tests were identical, but they did not produce the same results. I suspect that the problems are related to the way the Play! framework dynamically rewrites and instruments classes, both during compilation and at run-time. After many hours of searching and a significant amount of trial-and-error, I was able to resolve items #2 and #3 by writing a non-trivial amount of manual code to either circumvent or reimplement functionality provided by the Play! stack, but I was unable to resolve #1.
Ultimately, I decided that the framework was not saving me time; each small step forward seemed to result in another lengthy Internet search for help from others who might have had similar issues. I felt like I was working against the framework rather than allowing the framework to work for me, so I made the decision to try another approach. A friend recommended Restlet, so I went back to the drawing board and started over with it.