Grouping lets you categorize tests (smoke, regression, slow) and run subsets. TestNG uses @Test(groups=...) with include/exclude in testng.xml; JUnit 5 uses @Tag and selects tags via the build or @Suite.
TestNG: annotate @Test(groups = {"smoke", "login"}) and in testng.xml <groups><run><include name='smoke'/>. A method can belong to multiple groups, and group-level @BeforeGroups/@AfterGroups exist. JUnit 5: @Tag("smoke") on a test/class, then filter with Maven Surefire (groups/excludedGroups) or JUnit Platform tag expressions. Both let CI run 'smoke on PR, full nightly'. Groups/tags are the standard way to slice a large suite by suite type, speed, or feature. A consistent tagging taxonomy is important; unregistered/typo'd group names silently run nothing.
Both worlds tag critical paths (@Test(groups='smoke') / @Tag('smoke')) so the PR pipeline runs only smoke and the nightly runs everything — the same strategy, different syntax.
You want the same 'smoke subset on PR' capability in TestNG and in JUnit 5. What's the mechanism in each?