Results 1 to 2 of 2

Thread: Supporting transaction Rollback for End-to-end testing

  1. #1
    Join Date
    Aug 2010
    Posts
    4

    Default Supporting transaction Rollback for End-to-end testing

    Hi all,
    section 10.2 of the reference documentation provides an example for doing end-to-end tests using "JobLauncherTestUtils". The test consists of some data setup and then the job is launched. I've had some problems trying to run this with the @Transactional annotation, as ideally I'd like to rollback the data setup. In the meantime I've come across some threads which mention that a batch job cannot be run within a transaction. Is there a way to launch a job within a Transactional test?

    Thanks.

  2. #2
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    Quote Originally Posted by emallin View Post
    Is there a way to launch a job within a Transactional test?
    No. You will find plenty of threads discussing this problem. The short summary is that a Job in production is a complex interplay between multiple transactions, and it needs to keep control of that. It hasn't been worth it so far to provide an end-to-end transaction mode purely for test purposes. There are also JIRA issues open. If you want to take a crack at it, feel free.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •