Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,15 @@ private void ifMethodFixtureStarted(final ITestNGMethod testMethod) {
Current current = currentTestResult.get();
final FixtureResult fixture = getFixtureResult(testMethod);
final String uuid = currentExecutable.get();
if (testMethod.isBeforeMethodConfiguration()) {
if (isBeforeMethod(testMethod)) {
if (current.isStarted()) {
currentTestResult.remove();
current = currentTestResult.get();
}
getLifecycle().startPrepareFixture(createFakeContainer(testMethod, current), uuid, fixture);
}

if (testMethod.isAfterMethodConfiguration()) {
if (isAfterMethod(testMethod)) {
getLifecycle().startTearDownFixture(createFakeContainer(testMethod, current), uuid, fixture);
}
}
Expand Down Expand Up @@ -487,7 +487,7 @@ public void afterInvocation(final IInvokedMethod method, final ITestResult testR
}
getLifecycle().stopFixture(executableUuid);

if (testMethod.isBeforeMethodConfiguration() || testMethod.isAfterMethodConfiguration()) {
if (isBeforeMethod(testMethod) || isAfterMethod(testMethod)) {
final String containerUuid = currentTestContainer.get();
validateContainerExists(getQualifiedName(testMethod), containerUuid);
currentTestContainer.remove();
Expand Down Expand Up @@ -542,7 +542,8 @@ private boolean isSupportedConfigurationFixture(final ITestNGMethod testMethod)
return testMethod.isBeforeMethodConfiguration() || testMethod.isAfterMethodConfiguration()
|| testMethod.isBeforeTestConfiguration() || testMethod.isAfterTestConfiguration()
|| testMethod.isBeforeClassConfiguration() || testMethod.isAfterClassConfiguration()
|| testMethod.isBeforeSuiteConfiguration() || testMethod.isAfterSuiteConfiguration();
|| testMethod.isBeforeSuiteConfiguration() || testMethod.isAfterSuiteConfiguration()
|| testMethod.isBeforeGroupsConfiguration() || testMethod.isAfterGroupsConfiguration();
}

private void validateContainerExists(final String fixtureName, final String containerUuid) {
Expand Down Expand Up @@ -810,4 +811,12 @@ private enum CurrentStage {
TEST,
AFTER
}

private boolean isAfterMethod(ITestNGMethod testMethod) {
return testMethod.isAfterMethodConfiguration() || testMethod.isAfterGroupsConfiguration();
}

private boolean isBeforeMethod(ITestNGMethod testMethod) {
return testMethod.isBeforeMethodConfiguration() || testMethod.isBeforeGroupsConfiguration();
}
}