Adapt framework for testing, make tests use single transaction and be revertible #4414
Replies: 3 comments 2 replies
-
Hi @fmbenhassine ,what do you think about it? |
Beta Was this translation helpful? Give feedback.
-
A job might perform several transactions (through its steps). What, specifically, are you looking for? Are you asking to revert all transactions performed by a job that is run in a single JUnit test? |
Beta Was this translation helpful? Give feedback.
-
Even with a single step? To help you efficiently, please provide a minimal example that we can use to fully understand your expectations, see https://github.com/spring-projects/spring-batch/blob/main/ISSUE_REPORTING.md.
Which transaction attributes did you provide? Isolation levels and some propagation levels are not supported in Spring's Test Framework: https://docs.spring.io/spring-framework/reference/testing/testcontext-framework/tx.html#testcontext-tx-enabling-transactions. Again, for this kind of questions and to provide efficient support, please take some time to provide a minimal example. |
Beta Was this translation helpful? Give feedback.
-
It will be cool if there is an ability to revert changes produced from Spring batch job in test.
I tried to test some job or single step and found that typical Spring approach with idempotent tests using
@Transactional
doesn't work here. Even if transaction attributes were provided to support existing transaction andvalidateTransactionState
is disabled.So i would like to use it somehow like this
Expected Behavior
Current Behavior
There is no way to revert commits made by Spring batch transaction manager, or override transaction behaviour in tests.
Context
Spring batch test
Beta Was this translation helpful? Give feedback.
All reactions