spring-projects / spring-projects/spring-framework

Execute all test methods in a class within the same transaction [SPR-5520]

Open
#10,191 9 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: test type: enhancement
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

Eric Jain opened SPR-5520 and commented

Being able to configure that all test methods in a class should be run in the same transaction would be useful for people using TestNG (which supports test method dependencies) to write functional tests.

This feature could also be useful in JUnit Jupiter when using @TestInstance(PER_CLASS) or the planned support for scenario tests.


Affects: 2.5.6

Issue Links:

  • #21093 TestEntityManager can't be configured in @BeforeAll method in test class with @TestInstance(PER_CLASS) in JUnit Jupiter ("is duplicated by")
  • #16024 Support @Transactional on TestNG @BeforeClass methods in the TestContext framework

1 votes, 1 watchers

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by locating the Spring TestContext transaction support used with TestNG and JUnit Jupiter, then review the related @BeforeAll and @TestInstance(PER_CLASS) cases. Done means all test methods in a class can be configured to run within the same transaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.