InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Presentation: System Integration Testing with Spring

Posted by Floyd Marinescu on Aug 03, 2007

Sections
Development,
Architecture & Design
Topics
Java ,
Unit Testing ,
Software Testing
Tags
Spring ,
JUnit ,
TDD
Not only does Spring provide you an application configuration framework, it provides a holistic solution that makes your application's use cases and subsystems easier to test.  The emphasis is on testing outside a JEE server or container, thus greatly improving productivity.   In this presentation, recorded at The Spring Experience, Spring Creator Rod Johnson discusses integration testing and the support that Spring provides for it, issues around testing the persistence layer, and how to test web apps.

Watch System Integration Testing with Spring (82 min)

The presentation will include a demo showing how an application can be tested as it is developed without developers needing to wait for JEE container startup and deployment.   In the presentation Rod presents some of the unique features Spring has to facilitate testing:
  • Dependency Injection
  • Data access and transaction management
    • Automatic transaction creation and rollback
  • No need for setup/teardown scripts
    • Automatic rollback after each test method
    • Can be run directly from IDE
  • Context Caching + Auto-rollback = Rapid performance for better productivity
    • 100s of tests per minute
  • Integrated with other data access code and testing Spring configuration and other Spring code
    • Enables validation of triggers, sequences, stored procedures and JDBC code
  • Context caching between many test cases
    • Particularly important with Hibernate due to the cost of SessionFactory creation
    • Uses static Map to prevent loss of built configuration when JUnit destroys and reinstantiates test classes
  • Dependency injection of test cases to avoid the need for any glue code in tests
    • Focus on testing your mappings and queries, with minimal distraction from test setup
  • Zero changes required in DAOs or other application Java code between test and deployment

15 comments

Watch Thread Reply

Slides to download by Adelino Rodrigues Posted
Re: Slides to download by Wu Marshal Posted
Re: Slides to download by zhu super Posted
Re: Slides to download by Patricia Guimaraes Posted
Re: Slides to download by Prashant Bhate Posted
Re: Slides to download by Prashant Bhate Posted
Re: Slides to download by Jose Pena Posted
I really enjoyed the first 40 minutes by Laurent Ploix Posted
Wrong tool for UI unit tests by Marc Guillemot Posted
Re: Wrong tool for UI unit tests by anjan bacchu Posted
Re: Wrong tool for UI unit tests by Marc Guillemot Posted
Re: Wrong tool for UI unit tests by Alexandre Poitras Posted
Excellent presentation! by Igor Kolomiets Posted
Rollback Transaction by Rodolfo Rothganger Posted
Download by Hudson Leite Posted
  1. Back to top

    Slides to download

    by Adelino Rodrigues

    Would it be possible to have a URL with the slides to download?

  2. Back to top

    Re: Slides to download

    by Wu Marshal

    yes

  3. Back to top

    I really enjoyed the first 40 minutes

    by Laurent Ploix

    ...because you basically cover the basics of a good testing approach, with or without java, with or without Spring. Even people who don't use Java can listen to this conference - at least the first half -.

  4. Back to top

    Wrong tool for UI unit tests

    by Marc Guillemot

    Rod,
    I fear that your knowledge of UI unit test tools is outdated: HttpUnit is a dead project (or at least deeply asleep). This is the reason why we've moved to HtmlUnit for over 3 years in Canoo WebTest.
    HtmlUnit is also the default underlying layer used by jWebUnit (that you mentionned).
    Your assertion concerning limited js support is not fully correct either.

    Nevertheless all these tools are too low level and for instance junit like reports are too limited for UI tests. Have a look at WebTest tests written as unit tests in Groovy (just like what Grails can generate). This allows you to use the higher level API of WebTest and have reach reports just from your unit tests. This makes a real difference what concerns the maintainability.

  5. Back to top

    Excellent presentation!

    by Igor Kolomiets

    All these years I was blaming myself for being lazy and still using real db with transaction-wrapped test methods (with auto-rollback at the end) for testing DAO layer. I thought that best practices require using in-memory db (for speed) and using full-blown db data-fixture setup/cleanup steps before and after running each step (approach heavily advocated by ROR for example). The only reason I didn't go that route is the lack of immediate benefits. Now it's such a relief to hear from respected authority like Rod that it's a "good thing" :)

  6. Back to top

    Re: Wrong tool for UI unit tests

    by anjan bacchu

    Hi Marc,

    Thanks for updating the http/html unit testing scenario.

    Can you update with some links so that others can get a quick overview ?

    Thanks ,

    BR,
    ~A

  7. Back to top

    Re: Slides to download

    by zhu super

    How to download?

  8. Back to top

    Rollback Transaction

    by Rodolfo Rothganger

    Very usefull presentation!

    One small point: a complete test (not a Unit Test...) should check for failures during the transaction commit phase, including problems on a two phase commit scenarios.


    Regards,

    Rudolf

  9. Back to top

    Re: Wrong tool for UI unit tests

    by Marc Guillemot

    Ups, sorry:

    HtmlUnit: htmlunit.sourceforge.net
    WebTest: webtest.canoo.com
    WebTest from Groovy: groovy.codehaus.org/Testing+Web+Applications
    webtest.canoo.com/webtest/manual/groovyTesting....
    Screencast of Grails' WebTest (maybe already outdated, I don't know)
    grails.org/Grails+Screencasts

  10. Back to top

    Re: Wrong tool for UI unit tests

    by Alexandre Poitras

    Is it possible to use those UI unit tests tools in a EJB 2.x application ? Or I need to mock every ejbs?

  11. Back to top

    Re: Slides to download

    by Patricia Guimaraes

    I listened to this talk and thought it was excellent! I would very much like to get a copy of the slides. Could you provide instructions on how to do that? Previous postings state that it is possible, but don't say how.

    Thanks a lot,

    Pat

  12. Back to top

    Re: Slides to download

    by Prashant Bhate

    Hi,

    First of all , Thanks a lot Rod, for these wonderful slides :))

    Thanks to company firewall policies, Not all of us in the team have privileges to view *.swf content.

    So I used this Javascript snippet to view all Slides at once,


    <script>
    var slides=new Array('/resource/presentations/system-integration-testing-with-spring/en/slides/slide0.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide1.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide2.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide3.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide4.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide5.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide6.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide7.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide8.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide9.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide10.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide11.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide12.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide13.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide14.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide15.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide16.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide17.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide18.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide19.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide20.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide21.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide22.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide23.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide24.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide25.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide26.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide27.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide28.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide29.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide30.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide31.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide32.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide33.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide34.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide35.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide36.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide37.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide38.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide39.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide40.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide41.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide42.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide43.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide44.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide45.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide46.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide47.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide48.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide49.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide50.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide51.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide52.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide53.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide54.swf');
    for(slide in slides){
    //Browser can't Handle Too-many windows ;)
    if(slide%20 ==0 && !window.confirm("There are Still "+(slides.length-slide)+" slides, Start Opening slide#"+slide+"?")){
    break;
    }
    window.open("http://www.infoq.com"+slides[slide]);
    }
    </script>


    [and then , If Using IE,go to "Temp Internet Folder" (or appropriate cache/store folder of browser) and copy swf files from there to Local Disk :))
    ]

    Then shared these slides with my team here in my office, and Even they are very thankful to you Rod :)

  13. Back to top

    Re: Slides to download

    by Prashant Bhate

    Hi,

    First Of All, Thanks a lot Rod for the wonderful slides & Presentation :)

    Only Problems with the slides is the format i.e. *.swf. Not everyone has the privileges in My team to view flash content. [Thanks to company's Firewall policies].

    So I have Used this scriptlet to view all slides at once, and then Copied cached slides [From "Temp Internet Folder" if using IE or any other browsers' store floder] to Disk. Then I shared it with my team. Now they can watch it offline and Even my colleagues and team members are very greatful to you ;)


    --script-tag--
    var slides=new Array('/resource/presentations/system-integration-testing-with-spring/en/slides/slide0.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide1.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide2.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide3.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide4.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide5.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide6.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide7.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide8.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide9.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide10.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide11.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide12.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide13.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide14.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide15.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide16.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide17.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide18.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide19.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide20.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide21.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide22.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide23.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide24.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide25.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide26.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide27.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide28.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide29.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide30.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide31.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide32.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide33.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide34.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide35.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide36.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide37.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide38.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide39.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide40.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide41.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide42.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide43.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide44.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide45.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide46.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide47.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide48.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide49.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide50.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide51.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide52.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide53.swf','/resource/presentations/system-integration-testing-with-spring/en/slides/slide54.swf');
    for(slide in slides){
    //Browser can't handle too many open windows ;)
    if(slide%20 ==0 && !window.confirm("There are Still "+(slides.length-slide)+" slides, Start Opening slide#"+slide+"?")){
    break;
    }
    window.open("http://www.infoq.com"+slides[slide]);
    }
    --end-of-script-tag--

  14. Back to top

    Re: Slides to download

    by Jose Pena

    Where are the slides? I would have it, thanks

  15. Back to top

    Download

    by Hudson Leite

    Hi Guys,

    When you release the MP3 and Slides to download like the recents presentations?

    Thanks.

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.