diff --git a/src/main/java/com/seleniumboot/cucumber/CucumberHooks.java b/src/main/java/com/seleniumboot/cucumber/CucumberHooks.java index 9631900..bd4f00a 100644 --- a/src/main/java/com/seleniumboot/cucumber/CucumberHooks.java +++ b/src/main/java/com/seleniumboot/cucumber/CucumberHooks.java @@ -258,6 +258,7 @@ private static void abortQuarantinedScenario(String reason) { } } + /** Heuristic: a TestNG result is current only on a TestNG thread. Cucumber launched from inside a TestNG test is treated as TestNG. */ private static boolean isTestNgExecution() { try { return org.testng.Reporter.getCurrentTestResult() != null; diff --git a/src/test/java/com/seleniumboot/unit/CucumberQuarantineTest.java b/src/test/java/com/seleniumboot/unit/CucumberQuarantineTest.java index 77ee066..5ebb174 100644 --- a/src/test/java/com/seleniumboot/unit/CucumberQuarantineTest.java +++ b/src/test/java/com/seleniumboot/unit/CucumberQuarantineTest.java @@ -1,7 +1,6 @@ package com.seleniumboot.unit; import com.seleniumboot.cucumber.CucumberHooks; -import com.seleniumboot.internal.SeleniumBootContext; import com.seleniumboot.quarantine.QuarantineLoader; import io.cucumber.java.Before; import io.cucumber.java.Scenario; @@ -159,7 +158,6 @@ public void checkQuarantine_notQuarantined_doesNotThrow() throws Exception { public static class QuarantineStepDefinitions { @Before("@quarantine") public void beforeScenario(Scenario scenario) { - CucumberHooks hooks = new CucumberHooks(); // In a real run, Cucumber invokes hooks; here we directly invoke quarantine check try { Method m = CucumberHooks.class.getDeclaredMethod("checkCucumberQuarantine", Scenario.class); diff --git a/src/test/java/com/seleniumboot/unit/SeleniumBootLauncherListenerTest.java b/src/test/java/com/seleniumboot/unit/SeleniumBootLauncherListenerTest.java index 2a50265..1514991 100644 --- a/src/test/java/com/seleniumboot/unit/SeleniumBootLauncherListenerTest.java +++ b/src/test/java/com/seleniumboot/unit/SeleniumBootLauncherListenerTest.java @@ -3,7 +3,6 @@ import com.seleniumboot.hooks.ExecutionHook; import com.seleniumboot.hooks.HookRegistry; import com.seleniumboot.junit5.SeleniumBootLauncherListener; -import com.seleniumboot.precondition.BaseConditions; import com.seleniumboot.precondition.PreConditionRegistry; import com.seleniumboot.testmanagement.TestManagementReporter; import org.testng.annotations.AfterMethod;