Class: QaServer::ScenarioValidator

Inherits:
Object
  • Object
show all
Defined in:
app/validators/qa_server/scenario_validator.rb

Constant Summary collapse

PASS =
:good
FAIL =
:bad
UNKNOWN =
:unknown
VALIDATE_CONNECTION =
:connection
VALIDATE_ACCURACY =
:accuracy
VALIDATE_ACCURACY_COMPARISON =
:accuracy_comparison
ALL_VALIDATIONS =
:all_validations
DEFAULT_VALIDATION_TYPE =
VALIDATE_CONNECTION

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scenario:, status_log:, validation_type: DEFAULT_VALIDATION_TYPE) ⇒ ScenarioValidator

Returns a new instance of ScenarioValidator.

Parameters:

  • scenario (SearchScenario | TermScenario)

    the scenario to run

  • status_log (ScenarioLogger)

    logger for recording test results

  • validation_type (Symbol) (defaults to: DEFAULT_VALIDATION_TYPE)

    the type of scenarios to run (e.g. VALIDATE_CONNECTION, VALIDATE_ACCURACY, ALL_VALIDATIONS)



20
21
22
23
24
# File 'app/validators/qa_server/scenario_validator.rb', line 20

def initialize(scenario:, status_log:, validation_type: DEFAULT_VALIDATION_TYPE)
  @status_log = status_log
  @scenario = scenario
  @validation_type = validation_type
end

Instance Attribute Details

#scenarioObject (readonly)

Returns the value of attribute scenario.



15
16
17
# File 'app/validators/qa_server/scenario_validator.rb', line 15

def scenario
  @scenario
end

#status_logObject (readonly)

Returns the value of attribute status_log.



15
16
17
# File 'app/validators/qa_server/scenario_validator.rb', line 15

def status_log
  @status_log
end

#validation_typeObject (readonly)

Returns the value of attribute validation_type.



15
16
17
# File 'app/validators/qa_server/scenario_validator.rb', line 15

def validation_type
  @validation_type
end

Instance Method Details

#log_without_runningObject

Log the structure of the scenario without running the scenario test.



33
34
35
# File 'app/validators/qa_server/scenario_validator.rb', line 33

def log_without_running
  log
end

#runObject

Run a search scenario and log results.



27
28
29
30
# File 'app/validators/qa_server/scenario_validator.rb', line 27

def run
  run_accuracy_scenario if accuracy_scenario? && validating_accuracy?
  run_connection_scenario if connection_scenario? && validating_connections?
end