Class: Capsium::Package::Testing::TestSuite
- Inherits:
-
Object
- Object
- Capsium::Package::Testing::TestSuite
- Defined in:
- lib/capsium/package/testing/test_suite.rb,
sig/capsium/package/testing/test_suite.rbs
Overview
Loads and runs the package's tests/*.yaml suites (05x-testing). Route tests are served by a reactor on an ephemeral port for the duration of the run.
Constant Summary collapse
- TESTS_DIR =
"tests"- BUILTIN_TEST_KINDS =
Referencing the built-in test kinds triggers their autoload, which registers them in TestCase.types (each kind file self-registers on load).
[RouteTest, FileTest, DataValidationTest, ConfigTest].freeze
Instance Attribute Summary collapse
-
#package ⇒ Capsium::Package
readonly
Returns the value of attribute package.
Instance Method Summary collapse
-
#initialize(package) ⇒ TestSuite
constructor
A new instance of TestSuite.
- #run ⇒ Report
- #test_files ⇒ Array[String]
Constructor Details
#initialize(package) ⇒ TestSuite
Returns a new instance of TestSuite.
23 24 25 |
# File 'lib/capsium/package/testing/test_suite.rb', line 23 def initialize(package) @package = package end |
Instance Attribute Details
#package ⇒ Capsium::Package (readonly)
Returns the value of attribute package.
21 22 23 |
# File 'lib/capsium/package/testing/test_suite.rb', line 21 def package @package end |
Instance Method Details
#run ⇒ Report
31 32 33 34 35 36 37 38 39 |
# File 'lib/capsium/package/testing/test_suite.rb', line 31 def run report = Report.new loaded = load_cases(report) with_reactor(loaded) do |base_url| context = Context.new(package_path: @package.path, base_url: base_url) loaded.each { |test_case| report << run_case(test_case, context) } end report end |
#test_files ⇒ Array[String]
27 28 29 |
# File 'lib/capsium/package/testing/test_suite.rb', line 27 def test_files Dir.glob(File.join(@package.path, TESTS_DIR, "*.{yaml,yml}")) end |