Skip to content

MCP server: accunit-tests skill and tools to import, export and remove test classes - #93

Merged
josef-poetzl merged 5 commits into
devfrom
feature/mcp-export-remove-test-classes
Nov 17, 2026
Merged

josef-poetzl merged 5 commits into
devfrom
feature/mcp-export-remove-test-classes

Conversation

@josef-poetzl

Copy link
Copy Markdown
Member

Summary

Writing AccUnit tests with an AI agent no longer depends on other tools (e.g. msaccess-vcs) to get test classes into the database.

Skill accunit-tests and server instructions

  • Skill shipped with the server, accunit_install_skill, short server instructions for clients without skill support.
  • Specification = method name + declaration + comment from accunit_generate_test_class; the agent does not read the code under test on its own. If expected behavior cannot be derived, it asks the developer once how to proceed (assume values, look at the code, developer specifies, leave out).
  • Assert.Throws with the VBA error number, Ignore only for open expected behavior, start with accunit_generate_test_class, explicit skill invocation note in the README.

New tools

  • accunit_import_test_classes(fileNameFilter, importPath): imports test classes and test related modules with the import of the AccUnit core. Only modules with 'AccUnit:TestClass / 'AccUnit:TestRelated; other modules are never replaced. UTF-8 or ANSI input is converted to a temporary ANSI copy with CRLF; code without export header gets the class header. Imported modules are saved with DoCmd.Save acModule, otherwise Quit(acQuitSaveAll) shows a modal "Save As" dialog.
  • accunit_export_test_classes(classNames, overwrite) and accunit_remove_test_classes(classNames, exportBeforeRemoving): single test modules only; files written over are kept as .bak.
  • accunit_generate_test_class returns the AccUnit test folder (testFolder).
  • Existing test class: the agent creates the second class (e.g. modCalcTests1) first, then asks the developer to merge, replace or keep both.

Tests

  • Unit tests for file checks, encoding conversion, selection and backup; all MCP server tests pass (MSBuild, VSTest).
  • Manual over stdio against a test database: import (UTF-8/ANSI, with and without header), replace without duplicates, protection of non-test modules, run tests, export with/without overwrite, merge of a second class, remove.

Follow-up

  • Switching test class export/import in the core to UTF-8 with BOM (setting, ANSI optional) is handled in a separate branch.

Start with accunit_generate_test_class and do not read the source of the
module under test; ask the developer once how to handle behavior that
cannot be derived. Use the VBA error number for Assert.Throws, restrict
Ignore to open expected behavior and note explicit skill invocation.
Import test classes and test related modules from source files with the
import of the AccUnit core, so writing tests no longer depends on
msaccess-vcs. Files are converted to the ANSI code page, get the class
export header if missing and are saved with DoCmd.Save to avoid the
Save As dialog on quit. Modules that are not test modules are never
replaced. The draft returns the AccUnit test folder.
accunit_export_test_classes and accunit_remove_test_classes work only on
test modules and keep files they write over as .bak. The skill now
creates a second test class first and asks the developer whether to
merge it, replace the existing class or keep both.
@josef-poetzl
josef-poetzl merged commit d55ac03 into dev Nov 17, 2026
1 check passed
@josef-poetzl
josef-poetzl deleted the feature/mcp-export-remove-test-classes branch November 17, 2026 13:47
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