Enum Class TestType

java.lang.Object
java.lang.Enum<TestType>
org.ek9lang.cli.TestType
All Implemented Interfaces:
Serializable, Comparable<TestType>, Constable

public enum TestType extends Enum<TestType>
Classification of @Test program types based on validation mechanism.

EK9 supports five distinct testing paradigms:

  • ASSERT: Traditional unit tests using assert/assertThrows/assertDoesNotThrow. No expected output files. Test passes if no assertion failures occur.
  • BLACKBOX: Output validation via single expected_output.txt file. Program runs without arguments. Actual stdout compared to expected file.
  • BLACKBOX_HYBRID: Combines blackbox output validation WITH assertions. Both the expected output must match AND all assertions must pass.
  • PARAMETERIZED: Multiple test cases with commandline_arg_*.txt and expected_case_*.txt file pairs. Each case runs independently with its arguments.
  • PARAMETERIZED_HYBRID: Parameterized test cases that also use assertions. Each case must match expected output AND pass all assertions.

Hybrid tests are detected at runtime when a blackbox/parameterized test fails due to assertion failure (not output mismatch). Full compile-time detection of hybrid tests requires call-graph analysis (Phase C).

  • Enum Constant Details

    • ASSERT

      public static final TestType ASSERT
      Pure assertion-based test with no expected output files. Uses assert, assertThrows, assertDoesNotThrow statements.
    • BLACKBOX

      public static final TestType BLACKBOX
      Single expected_output.txt file, no command line arguments, no assertions. Validates program stdout against expected output only.
    • BLACKBOX_HYBRID

      public static final TestType BLACKBOX_HYBRID
      Single expected_output.txt file WITH assertions. Both output validation and assertion checks must pass.
    • PARAMETERIZED

      public static final TestType PARAMETERIZED
      Multiple test cases with commandline_arg_*.txt and expected_case_*.txt pairs. Each case is a separate test execution with specific arguments, no assertions.
    • PARAMETERIZED_HYBRID

      public static final TestType PARAMETERIZED_HYBRID
      Parameterized test cases WITH assertions. Each case must match expected output AND pass all assertions.
  • Method Details

    • values

      public static TestType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TestType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • jsonValue

      public String jsonValue()
      Value for JSON and machine-readable output (lowercase with underscores). Consistent across all formats: JSON, JUnit XML properties, etc.
    • shortLabel

      public String shortLabel()
      Short label for human-readable output in result lines. For parameterized tests, callers append case ID: "Param:caseid"
    • description

      public String description()
      Descriptive text for discovery output explaining the test type.
    • validatesOutput

      public boolean validatesOutput()
      Check if this test type validates output against expected files.
    • usesAssertions

      public boolean usesAssertions()
      Check if this test type uses assertions.
    • isHybrid

      public boolean isHybrid()
      Check if this is a hybrid test (both output validation and assertions).
    • toHybrid

      public TestType toHybrid()
      Get the hybrid variant of this test type. Returns self if already hybrid or if ASSERT (no hybrid variant).