Class TestCaseDiscovery

java.lang.Object
org.ek9lang.cli.TestCaseDiscovery

final class TestCaseDiscovery extends Object
Discovers test cases from expected output files for black-box testing.

Black-box tests validate program output against expected files. Two patterns are supported:

  • Simple: Single expected_output.txt file (no arguments)
  • Parameterized: commandline_arg_{id}.txt + expected_case_{id}.txt pairs

Tests without expected files are assert-based tests (validated by assertion success).

Configuration errors are reported using error codes from TestConfigurationError with detailed messages from VerboseErrorMessages when running with higher error verbosity.

See Also:
  • Constructor Details

    • TestCaseDiscovery

      TestCaseDiscovery(int errorLevel)
      Create discovery with specified error verbosity level.
      Parameters:
      errorLevel - 0=minimal, 1=visual, 2=fuzzy, 3=verbose
  • Method Details

    • discover

      List<TestCase> discover(TestProgram test)
      Discover all test cases for a test program.

      Returns empty list if no expected files found (assert-based test). Returns single TestCase for simple expected_output.txt. Returns multiple TestCases for parameterized commandline_arg_*.txt files.

      Parameters:
      test - The test program to discover cases for
      Returns:
      List of test cases (empty if assert-based test)
    • discoverWithMetadata

      DiscoveredTest discoverWithMetadata(TestProgram test)
      Discover a test program with full metadata including test type classification.

      This method provides complete information about the test for reporting:

      • Test type (ASSERT, BLACKBOX, PARAMETERIZED)
      • Number of test cases for parameterized tests
      • All test case details
      • Configuration errors if any
      Parameters:
      test - The test program to analyze
      Returns:
      DiscoveredTest with full metadata