2

We have a web application (using Grails/Groovy) and we write unit tests and functional tests.

However, we are not writing integration tests.

With unit tests, we can catch some small issues and also, it helps us writing our codebase in modular, short and readable fashion.

Functional tests obviously helps us to know when a feature is broken.

What would be get from writing integration tests? What would be the benefits of the extra time spent writing these tests?

ontk
  • 942
  • 1
  • 10
  • 24
  • 1
    take a look at this post http://stackoverflow.com/questions/3670729/what-is-the-difference-between-integration-testing-and-functional-testing – Alidad Jun 14 '13 at 21:52

4 Answers4

3

The question is "What would be get from writing integration tests? What would be the benefits of the extra time spent writing these tests?"

Your integration tests will ensure that your components work together with cross cutting concerns such as web services, db, session etc. You only need only few integration tests - As @bagheera's comment on TestPyramid. Be aware how you write integration tests because if you go overboard, it can really slow to run all of them, and harder to work with. When you compare them to Unit Tests, you don't get much benefit of writing them.

Addtional : You need lot of Unit Tests - you already have this and it is a good sign. You don't want tests in between this, which is called "dirty hybrids" http://blog.stevensanderson.com/2009/08/24/writing-great-unit-tests-best-and-worst-practises/

Spock
  • 7,009
  • 1
  • 41
  • 60
2

From:

http://martinfowler.com/bliki/TestPyramid.html

The pyramid also argues for an intermediate layer of tests that act through a service layer of an application, what I refer to as SubcutaneousTests. These can provide many of the advantages of end-to-end tests but avoid many of the complexities of dealing with UI frameworks. In web applications this would correspond to testing through an API layer while the top UI part of the pyramid would correspond to tests using something like Selenium or Sahi..

ottodidakt
  • 3,631
  • 4
  • 28
  • 34
1

In addition to checking your application's plumbing as @Raedwald mentioned, integration tests are great for testing that your persistence layer is working as you expect. Are cascades set up correctly? Is everything rolled back properly if something blows up during a transaction? It's often much easier to directly check this stuff with an integration test rather than a functional test.

rcgeorge23
  • 3,594
  • 4
  • 29
  • 54
0

I find they are useful for checking the 'plumbing' of an application. For checking that your units are connected together and that delegating objects meet the preconditions of the methods they delegating to.

Raedwald
  • 46,613
  • 43
  • 151
  • 237