Class JvmTestExecutor
- All Implemented Interfaces:
TestExecutor
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface TestExecutor
TestExecutor.ExecutionResult -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute(TestProgram test) Execute a test program and capture its output.execute(TestProgram test, List<String> arguments) Execute a test program with command line arguments.voidLoad all compiled classes to register their coverage probes.
-
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:TestExecutorExecute a test program and capture its output.- Specified by:
executein interfaceTestExecutor- Parameters:
test- The test program to execute- Returns:
- Execution result with captured output and status
-
execute
Description copied from interface:TestExecutorExecute a test program with command line arguments.Used for parameterized black-box tests where arguments are read from commandline_arg_*.txt files.
- Specified by:
executein interfaceTestExecutor- Parameters:
test- The test program to executearguments- 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:
loadAllClassesForCoveragein interfaceTestExecutor
-