Skip to content

test: add build tests for Excel#4

Open
DecimalTurn wants to merge 6 commits into
WilliamSmithEdward:mainfrom
DecimalTurn:ci-tests
Open

test: add build tests for Excel#4
DecimalTurn wants to merge 6 commits into
WilliamSmithEdward:mainfrom
DecimalTurn:ci-tests

Conversation

@DecimalTurn

@DecimalTurn DecimalTurn commented Jul 25, 2026

Copy link
Copy Markdown

As mentioned in #1, this pull request introduces a CI workflow for building and testing Excel VBA fixtures on a GitHub Windows runner.

  • Makes use of the setup-vba action that I maintain to get the runner ready to run VBA code.
  • Uses the checked out version of pyOpenVBA to build the Excel files
  • Tests them by running a macro inside the file using COM automation
  • Takes a screenshot to help with debugging issues when the build or a test fails

I think this might be useful for this project to have such CI tests to help detect errors without having to run long running tests on a local dev machine.

ci: update workflow to set PYTHONPATH and remove local installation step

Fix Excel macro test workflow: add pywin32 postinstall, improve diagnostics and error handling

ci: increase timeout for Excel macro test job from 8 to 15 minutes

Fix encoding error: use ASCII dashes instead of Unicode

Add debug logging and error handling to fixture runner

fix: remove remaining Unicode and set UTF-8 output encoding on Windows

Add pre-built module_only.xlsm and parallel test jobs (fast + full)

Fix YAML syntax error: simplify test step and add CLI arg support

fix(test): improve Excel cleanup with gc.collect() and longer wait

- Add explicit garbage collection between fixtures
- Increase wait time after xl.Quit() to 3 second
- Nullify wb and xl references after cleanup
- Prevents hangs when running multiple workbooks sequentially

test: remove module_only.xlsm and simplify workflow configuration

debug: add detailed logging to diagnose fixture runner hangs

Add comprehensive debug output at each step:
- Fixture processing start/end
- Dispatch, Open, Run, Close sequence with timestamps
- Workbook closing with error handling
- Excel.Quit() with explicit error reporting
- Cleanup phases (gc.collect, wait)
- Main loop progress with file/fixture count

All output flushed for real-time visibility in CI logs.

fix(test): diagnose and fix with_class fixture hang

- Add 5min test step timeout
- Add screenshot on failure to visualize hung state
- Reduce cleanup wait from 3s to 1s (not the bottleneck)
- Improve with_class macro robustness:
  - Add error handling for file I/O
  - Fallback to TEMP if ThisWorkbook.Path is empty
  - Handle macro execution errors gracefully
- Update run script to check TEMP dir for output files
- Upload failure screenshots as artifacts

ci: extract screenshot logic into separate ps1 file

- Create scripts/take-screenshot-on-failure.ps1 with reusable logic
- Minimize PowerShell window before capturing screenshot
- Update workflow to call external script instead of inline code
- Cleaner and more maintainable workflow configuration

fix: make Excel application visible for debugging screenshots
- Search for and minimize all PowerShell/pwsh windows, not just current process
- Check window visibility before minimizing
- Add better logging for debugging
- More robust for CI environments where window context differs

ci: run screenshot in separate hidden process

fix(test): show VBE window for error diagnostics

ci: align with VBA-Build screenshot approach

ci: target CMD window minimization

ci: target HostedComputeAgent window

ci: add current window minimization

ci: add ListVisibleWindows utility for reporting visible windows
@DecimalTurn

Copy link
Copy Markdown
Author

@WilliamSmithEdward I realize that the following headers were actually missing from the .cls file.

VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END

Since, the VBE export usually has them, I think it is better to include them after all, but it seems that it works either way which is a good thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant