Announcement Announcement Module
Collapse
No announcement yet.
For large projects, what is the thinnest/easiest way to test the web tier? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • For large projects, what is the thinnest/easiest way to test the web tier?

    For large projects, what is the thinnest/easiest way to test the web tier?

    Every time I go to test controllers... I am met with tough emotions to battle because of how "heavy" it is to build and test controllers. I know they get simpler and simpler... but it's awful to do it. I've put up with it so much in the past... but I'm thinking... there has GOT to be a better way.

    Is there? What is the easiest/thinnest approach to building spring mvc controllers? Or is there an alternate way that doesn't involve spring mvc?

    I guess I just find the entire affair heavy and bloated, especially controllers that are supposed to be simple.

    When controllers need to reuse logic from other controllers, there aren't many good ways to do it... mixing annotations with base/sub classes is messy and confusing... and that just makes editing them more error prone.

    There has go to be a better way! Can anyone show me the light? Thanks!

  • #2
    When I want to integration test or acceptance test my web tier, I just stand up a quick Jetty server in my Eclipse environment (usually with the debugger). I let Jetty kick off my web application, and since it uses my Eclipse environment, all of the necessary dependencies are there -- I don't have to worry about packaging and deploying a WAR file quite yet.

    Read here for an example.

    Of course, this does not address unit testing your controllers, but it is a quick-and-dirty way to test your web application.

    Comment


    • #3
      Oh, I don't mind manually running the app server. In fact, I setup freemarker so that I update the pages while the server is running, so I never have to restart.

      The real pain is unit testing, and doing it predictably.

      There are so many things that can go wrong. For example, we could mock service object, and just "assume" what the domain object is going to be when it's pulled back. Then we go to deploy the application... and bam! - we got a lazy initialization exception!

      If we do use a database, we have to be concerned with how transactions and workflow operates - especially with stateful data and controllers that are in "mid process" and stuff like that. There are many ways to miss a small detail on how Servlets and the request parameters are going to work.

      Things get even more complicated when you got array notation in request parameters and more complex mapping going on.

      To me, the potential for errors is MASSIVE. There has to be a better way. It's so damn bloated and complicated. It's easy to spend a lot of time here, and frankly, it's time I don't have on the project I'm working on

      Any ideas?

      Comment

      Working...
      X