Module: Botrytis::CucumberIntegration::SemanticStepMatcher

Defined in:
lib/botrytis/cucumber.rb

Instance Method Summary collapse

Instance Method Details

#step_matches(name_to_match) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/botrytis/cucumber.rb', line 91

def step_matches(name_to_match)
  # First try the normal step matching
  matches = super(name_to_match)
  
  if matches.any?
    return matches
  end
  
  # If no exact matches, try semantic matching
  # Track semantic match attempts
  Botrytis::CucumberIntegration.record_step_attempt!
  semantic_match = attempt_semantic_match(name_to_match)
  
  if semantic_match
    # Semantic match found
    Botrytis::CucumberIntegration.record_semantic_match!
    return [semantic_match]
  else
    # No semantic match found
    return matches # Return empty array, which will result in undefined step
  end
end