Improved testing of Griffon applications - No Fluff Just Stuff

Improved testing of Griffon applications

Posted by: Andres Almiray on November 2, 2008

Since the initial launch of the Griffon framework a couple of weeks ago we (the Griffon team) have received a lot of feedback on the mailing lists, one of the most recurrent topics is proper testing of a Griffon application. Granted the framework is still in the early stages but we shouldn't skip providing good support for testing, I'm glad to say this oversight has been corrected :-D

Starting with the next release (or if you care to download a copy from the current HEAD) you'll see two familiar scripts if you're coming from Grails: create-unit-test and test-app. The first script, as the name suggests, will let you create an arbitrary unit test (remember that whenever you create a controller or an mvc group you will have an automatically created integration test for that controller as well) for any piece of your Griffon app. The second script will let you run all unit and integration tests, closing the circle as you previously couldn't run any tests at all.

It is worth mentioning that when it comes to UI testing or functional testing the regular facilities provided by JUnit or TestNG are not enough, that is why we are working hard to get the plugin architecture in place, thus allowing testing of Griffon applications with FEST and/or Easyb, stay tuned for more updates on that front.

One last thing to mention (and a very cool one), Griffon has also borrowed from Grails a very useful script written by awesome @glen_a_smith: stats. This little script will inspect your code and output a listing of LoC (lines of code) of all your application files grouped by stereotype, here is a sample from Greet
    +----------------------+-------+-------+
    | Name                 | Files |  LOC  |
    +----------------------+-------+-------+
    | Controllers          |     1 |   185 |
    | Models               |     1 |    14 |
    | Views                |     2 |   216 |
    | Services             |     1 |   197 |
    | Lifecycle            |     5 |    88 |
    | Java Source          |     2 |    85 |
    +----------------------+-------+-------+
    | Totals               |    12 |   785 |
    +----------------------+-------+-------+

Keep on Grooving! and don't forget to take Griffon for a spin, we'd love to receive your feedback ;-)
Andres Almiray

About Andres Almiray

Andres is a Java/Groovy developer and a Java Champion with more than 20 years of experience in software design and development. He has been involved in web and desktop application development since the early days of Java. Andres is a true believer in open source and has participated on popular projects like Groovy, Griffon, and DbUnit, as well as starting his own projects (Json-lib, EZMorph, GraphicsBuilder, JideBuilder). Founding member of the Griffon framework and Hackergarten community event. https://ch.linkedin.com/in/aalmiray

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »