Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do.
-- Steve Jobs
Showing posts with label Unit Test. Show all posts
Showing posts with label Unit Test. Show all posts

Monday, October 10, 2011

Countdown to Grails 2.0: Unit testing | SpringSource Team Blog

Countdown to Grails 2.0: Unit testing | SpringSource Team Blog
The first milestone of Grails 1.4 (now 2.0) has now been released and we are on the last stages of the journey towards 1.4 2.0 final. As we approach that point, I will be writing a series of blog posts that cover the various new features and changes that the 1.4 2.0 version brings. I'll be starting with the new testing support.
Since the beginning, Grails has provided three levels of testing support for developers: unit, integration, and functional. Unit tests had and still have the benefit of running independently of Grails, but they typically required a fair bit of extra work in the form of mocking. The unit test framework introduced with Grails 1.1 helped with that mocking, but it still didn't cover all use cases and so developers needed to resort to integration tests, which run inside a bootstrapped Grails instance, earlier than was desirable.
Grails 2.0 introduces significant changes that improve the situation considerably:
  • the unit test support can be integrated into any test framework (no more base classes);
  • it has a full in-memory GORM implementation; and
  • it better supports testing REST actions, file uploads, and more.
So what do these changes look like to you as a user?

Sunday, September 25, 2011

Mock testing with Grails | Mastering Grails

Mastering Grails: Mock testing with Grails
In this Mastering Grails installment, Scott Davis shows you how to take advantage of the built-in mocking capabilities of the GrailsUnitTestCase and ControllerUnitTestCase classes included with Grails.

Tuesday, September 20, 2011

End-to-End Test Driven Development in Grails – Part 1 | Cantina

End-to-End Test Driven Development in Grails – Part 1 « Cantina
Testing, and specifically test-driven development is a methodology which few developers fully embrace. Automated testing is inevitably viewed as something that can be done last minute once an application is completed, or it’s considered too time consuming to be done at all. What most people don’t realize though, is that over the lifetime of an application, and even during early development, testing saves countless hours. It allows developers to find errors early and reduces the amount of time spent debugging. It results in cleaner, simpler, and more understandable designs, and most importantly gives developers a much higher level of confidence in the final product.

Tuesday, September 6, 2011

Mocks Aren't Stubs | Martin Fowler

Mocks Aren't Stubs
The term 'Mock Objects' has become a popular one to describe special case objects that mimic real objects for testing. Most language environments now have frameworks that make it easy to create mock objects. What's often not realized, however, is that mock objects are but one form of special case test object, one that enables a different style of testing. In this article I'll explain how mock objects work, how they encourage testing based on behavior verification, and how the community around them uses them to develop a different style of testing.

Tuesday, August 2, 2011

Groovy MetaClass Magic in Unit Tests | Jworks.nl - Agile Software Development

Groovy MetaClass Magic in Unit Tests | Jworks.nl - Agile Software Development
As you may or may not know, Groovy has the concept of MetaClasses. MetaClasses enable you to add or change methods at runtime. This is especially handy when doing some mocking during a unit test (or, in our case, GrailsUnitTestCases). By mocking methods, you can mock out certain dependencies or behavior which you might not want during a unit test.