simply-view-image-for-python-debugging icon indicating copy to clipboard operation
simply-view-image-for-python-debugging copied to clipboard

Add comprehensive main workflow test for Python debugging with image viewing

Open Copilot opened this issue 6 months ago • 0 comments

This PR implements a comprehensive test suite that validates the main workflow of the "Simply View Image for Python Debugging" extension. The test covers the complete user journey from setting up a Python debugging session with image data to viewing images through the extension's webview interface.

What was added

Main Workflow Python Test Script (python_test/main_workflow_test.py)

Created a comprehensive test script that simulates real-world usage scenarios:

  • Creates various image and tensor data structures using built-in Python (no external dependencies)
  • Simulates numpy-like arrays with nested lists for compatibility
  • Provides multiple strategic breakpoint locations for testing
  • Includes metadata for different data types (RGB images, grayscale, tensors)

Comprehensive UI Test (tests/ui-test/python-debug.test.ts)

Implemented a full end-to-end test that validates:

  • Opening Python scripts with image/tensor variables
  • Setting breakpoints on lines containing image data
  • Starting Python debug sessions and verifying breakpoint hits
  • Testing extension's image viewing commands during active debugging
  • Validating webview functionality for image display
  • Handling multiple data types and debugging scenarios

Enhanced Test Infrastructure

  • Added run-basic-tests.mjs for CI-compatible validation tests
  • Updated validation tests to match the actual implementation
  • Enhanced launch configuration to support the main workflow test
  • Updated documentation with comprehensive testing guidance

Test Coverage

The main workflow test validates the complete extension workflow:

describe('main Workflow: Python Debugging with Image Viewing', function () {
  // Tests the complete journey:
  // 1. Script preparation with image/tensor data
  // 2. Debugging setup with strategic breakpoint placement  
  // 3. Debug session initiation and breakpoint verification
  // 4. Extension integration testing during active debugging
  // 5. Webview functionality for image display
  // 6. Multiple data type support (RGB, grayscale, tensors)
});

The Python test script creates realistic debugging scenarios:

def main():
    # Basic debugging variable
    x = "hello"
    print(f"The value of x is: {x}")  # Breakpoint location 1
    
    # Image data structures for extension testing
    sample_image = create_sample_image()  # Breakpoint location 2
    sample_tensor = create_sample_tensor()  # Breakpoint location 3
    
    # Multiple data types for comprehensive testing
    grayscale_image = create_numpy_like_array([64, 64], 'uint8')
    float_image = create_numpy_like_array([32, 32, 3], 'float32')

Benefits

  • Complete Workflow Coverage: Tests the extension's primary use case end-to-end
  • CI Compatible: Designed to work in headless environments with proper error handling
  • No External Dependencies: Uses built-in Python structures to avoid dependency issues
  • Comprehensive Documentation: Updated README with detailed testing guidance
  • Code Quality: All code passes linting and follows repository standards

This implementation ensures that the extension's main workflow - viewing images and tensors during Python debugging sessions - works correctly and can be validated automatically in CI environments.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Aug 30 '25 18:08 Copilot