Class JvmTestExecutor

java.lang.Object
org.ek9lang.cli.JvmTestExecutor
All Implemented Interfaces:
TestExecutor

final class JvmTestExecutor extends Object implements TestExecutor
Executes JVM bytecode test programs in-process.

This executor uses BytecodeExecutor to run compiled EK9 bytecode within the current JVM. This is significantly faster than spawning external JVM processes for each test.

Thread-safe: multiple tests can be executed in parallel, each with independent output capture via thread-local PrintStreams.

  • Constructor Details

    • JvmTestExecutor

      JvmTestExecutor(Path bytecodeDir)
      Create a JVM test executor.
      Parameters:
      bytecodeDir - Directory containing compiled .class files
  • Method Details

    • execute

      Description copied from interface: TestExecutor
      Execute a test program and capture its output.
      Specified by:
      execute in interface TestExecutor
      Parameters:
      test - The test program to execute
      Returns:
      Execution result with captured output and status
    • execute

      public TestExecutor.ExecutionResult execute(TestProgram test, List<String> arguments)
      Description copied from interface: TestExecutor
      Execute a test program with command line arguments.

      Used for parameterized black-box tests where arguments are read from commandline_arg_*.txt files.

      Specified by:
      execute in interface TestExecutor
      Parameters:
      test - The test program to execute
      arguments - Command line arguments to pass
      Returns:
      Execution result with captured output and status
    • loadAllClassesForCoverage

      public void loadAllClassesForCoverage()
      Load all compiled classes to register their coverage probes.

      This method walks through the bytecode directory and loads every .class file. When each class is loaded, its static initializer runs, which calls CoverageRuntime.registerMetadata() to register all coverage probes for that class.

      This ensures ALL compiled code (even unreferenced/untested code) appears in coverage reports with 0% coverage, rather than being silently omitted.

      Specified by:
      loadAllClassesForCoverage in interface TestExecutor