Announcement Announcement Module
Collapse
No announcement yet.
Supporting transaction Rollback for End-to-end testing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment

    Working...
    X