Java Test Automation / Scenario

Escape from TestNG: A Jupiter Migration Review

A TestNG suite is being ported to JUnit 5 and the draft PR crashes at startup, misuses assumptions as soft asserts, and loses skip-on-failure. Review it.

Difficulty
Medium
Format
Scenario
Points
150
Estimate
13 min

// MISSION BRIEF

Your Mission

Your team is migrating an API suite from TestNG to JUnit 5. The draft PR is up: it compiles, and it is wrong in three educational ways.

You have the original TestNG class, the Jupiter draft, and the startup error. Decide the correct mapping for each TestNG feature: instance @BeforeClass, dependsOnMethods, SoftAssert, groups, and listeners. The goal is a port that keeps the suite's semantics, not just its file names.

// FIRST CONTACT

Battle teaser

First artifact

Original: UserApiTests.java (TestNG)

Fixing the startup crash correctly:

  1. AEither make boot() static, or annotate the class @TestInstance(Lifecycle.PER_CLASS); the instance-method port fails because Jupiter's default lifecycle is one instance PER TEST
  2. BRename boot() to setUp(); Jupiter requires that name
  3. CReplace @BeforeAll with @BeforeEach and accept a new ApiClient per test as equivalent
  4. DDelete the lifecycle method and initialize client inline at field declaration, which is always identical in behavior
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

javajunit5migrationtestng