Class ProjectStructureManager

java.lang.Object
com.shaft.tools.io.internal.ProjectStructureManager

public class ProjectStructureManager extends Object
Initializes runtime project folders and service provider metadata files.
  • Constructor Details

    • ProjectStructureManager

      public ProjectStructureManager()
  • Method Details

    • identifyRunType

      public static ProjectStructureManager.RunType identifyRunType()
      Detects the active test runner from the current stack trace.
      Returns:
      the inferred execution mode
    • identifyRunType

      public static ProjectStructureManager.RunType identifyRunType(List<org.testng.xml.XmlSuite> suites)
      Detects the active test runner from the TestNG suites being altered.

      This overload exists specifically for IAlterSuiteListener.alter(List), which TestNG invokes directly during its own suite-processing phase, before any test method (and therefore before any Cucumber io.cucumber.core.runner.Runner stack frame) has run. At that point identifyRunType()'s stack probe can never observe Cucumber, even for a Cucumber-over-TestNG run (AbstractTestNGCucumberTests), so a caller at that call site is already known to be TestNG-driven — the only remaining question is whether TestNG is hosting a Cucumber runner. That is answered here by inspecting the suite's own class list instead of the call stack.

      Parameters:
      suites - the suites TestNG is about to run
      Returns:
      ProjectStructureManager.RunType.CUCUMBER when any suite (including suites reached transitively via <suite-file>) hosts a Cucumber TestNG runner class, whether declared directly in <classes> (with or without a <methods> filter) or discovered by a <packages> scan, ProjectStructureManager.RunType.TESTNG otherwise
    • initialize

      public static void initialize(ProjectStructureManager.RunType runType)
      Prepares project structure and listener registration files based on run type.
      Parameters:
      runType - current execution framework mode