Class: Omnitest::Skeptic::TestManifest

Inherits:
Core::Dash
  • Object
show all
Extended by:
Core::Dash::Loadable
Includes:
Core::DefaultLogger, Core::Logging
Defined in:
lib/omnitest/skeptic/test_manifest.rb

Overview

Omnitest::TestManifest acts as a test manifest. It defines the test scenarios that should be run, and may be shared across multiple projects when used for a compliance suite.

A manifest is generally defined and loaded from YAML. Here’s an example manifest:

---
global_env:
  LOCALE: <%= ENV['LANG'] %>
  FAVORITE_NUMBER: 5
suites:
  Katas:
    env:
      NAME: 'Max'
    samples:
      - hello world
      - quine
  Tutorials:
        env:
        samples:
          - deploying
          - documenting

The suites object defines the tests. Each object, under suites, like Katas or Tutorials in this example, represents a test suite. A test suite is subdivided into samples, that each act as a scenario. The global_env object and the env under each suite define (and standardize) the input for each test. The global_env values will be made available to all tests as environment variables, along with the env values for that specific test.

Defined Under Namespace

Classes: Environment, Suite

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#scenario_definitionsObject

Returns the value of attribute scenario_definitions.



50
51
52
# File 'lib/omnitest/skeptic/test_manifest.rb', line 50

def scenario_definitions
  @scenario_definitions
end

#scenariosObject

Returns the value of attribute scenarios.



51
52
53
# File 'lib/omnitest/skeptic/test_manifest.rb', line 51

def scenarios
  @scenarios
end

Instance Method Details

#build_scenario_definitionsObject



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/omnitest/skeptic/test_manifest.rb', line 57

def build_scenario_definitions
  definitions = Set.new
  suites.each do | suite_name, suite |
    suite.samples.each do | sample_pattern |
      expand_pattern(sample_pattern).each do | sample |
        definitions << ScenarioDefinition.new(name: sample, suite: suite_name, vars: suite.env)
      end
    end
  end
  definitions
end