A modern, efficient testing framework for the CF Java Plugin using Python and pytest.
# Setup
./test.py setup
# Run tests
./test.py all # Run all tests
./test.py basic # Basic commands
./test.py jfr # JFR tests
./test.py asprof # Async-profiler (SapMachine)
./test.py profiling # All profiling tests
# Common options
./test.py --failed all # Re-run failed tests
./test.py --html basic # Generate HTML report
./test.py --parallel all # Parallel execution
./test.py --fail-fast all # Stop on first failure
./test.py --no-initial-restart all # Skip app restarts (faster)
./test.py --stats all # Enable CF command statistics
./test.py --start-with TestClass::test_method all # Start with a specific test (inclusive)The following error might occur when connected to the SAP internal network:
ssh: handshake failed: read tcp 10.16.73.196:64531->18.157.52.48:2222: read: connection reset by peerJust connect directly to the internet without the VPN.
heap-dumpis thoroughly tested, including all flags, so that less has to be tested for the other commands.
Use the list command to explore available tests:
# Show all tests with class prefixes (ready to copy/paste)
./test.py list
# Show only method names without class prefixes
./test.py list --short
# Show with line numbers and docstrings
./test.py list --verbose
# Show only application names used in tests
./test.py list --apps-onlyExample output:
📁 test_asprof.py
📋 TestAsprofBasic - Basic async-profiler functionality.
🎯 App: sapmachine21
• TestAsprofBasic::test_status_no_profiling
• TestAsprofBasic::test_cpu_profiling
test_basic_commands.py- Core commands (heap-dump, vm-info, thread-dump, etc.)test_jfr.py- Java Flight Recorder profiling teststest_asprof.py- Async-profiler tests (SapMachine only)test_cf_java_plugin.py- Integration and workflow teststest_disk_full.py- Tests for disk full scenarios (e.g., heap dump with no space left)test_jre21.py- JRE21/non-SapMachine21-specific tests (e.g., heap dump, thread dump, etc.)
# Copy test name from `./test.py list` and run directly
./test.py run TestAsprofBasic::test_cpu_profiling
# Run by test class
./test.py run test_asprof.py::TestAsprofBasic
# Run by file
./test.py run test_basic_commands.py
# Search by pattern
./test.py run test_cpu_profilingAfter interruption or failure, the CLI shows actionable suggestions:
❌ Tests failed
💡 Use --failed to re-run only failed tests
💡 Use --start-with TestClass::test_method to resume from a specific test (inclusive)Tests are organized by application requirements:
all- Tests that run on any Java application (sapmachine21)sapmachine21- Tests specific to SapMachine (async-profiler support)
./test.py --stats all # Track all CF commands with performance insightsexport RESTART_APPS="never" # Skip app restarts (faster)
export CF_COMMAND_STATS="true" # Global command tracking# Skip app restarts for faster test iterations
./test.py --no-initial-restart basic
# Stop immediately on first failure
./test.py --fail-fast all
# Combine for fastest feedback
./test.py --no-initial-restart --fail-fast basicTests are automatically grouped by app to prevent interference:
./test.py --parallel all # Safe parallel execution./test.py --html all # Generate detailed HTML test report./test.py setup # Setup environment
./test.py clean # Clean artifactsThe framework uses a decorator-based approach:
from framework.decorators import test
from framework.runner import TestBase
class TestExample(TestBase):
@test # or @test(ine21")
def test_heap_dump_basic(self, t, app):
t.heap_dump("--local-dir .") \
.should_succeed() \
.should_create_file(f"{app}-heapdump-*.hprof")- Start with
./test.py listto see all available tests - Use
--apps-onlyto see which applications are needed - Copy test names directly from the list output to run specific tests
- Use
--failedto quickly re-run only failed tests after fixing issues - Use
--parallelfor faster execution of large test suites - Use
--htmlto get detailed reports with logs and timing information