The `office-addin-test-server` package provides a lightweight local web server specifically designed for testing Office Add-ins. It's a key component within the larger `OfficeDev/Office-Addin-Scripts` ecosystem, offering a framework for add-ins to send test results, which can then be consumed by test runners like Mocha to validate functionality. Currently stable at version 2.0.4, this package facilitates automated testing workflows by acting as a collection point for results from add-in runtime environments. Unlike general-purpose web servers, its differentiation lies in its tight integration with Office Add-in development, simplifying the process of capturing and processing test outcomes from within Office applications.
npm install office-addin-test-serverVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically start and stop the `office-addin-test-server` to receive simulated test results from an Office Add-in. It sets up a local server, waits for a mock result submission, and then gracefully shuts down the server. This pattern is foundational for automated testing of Office Add-ins.
Upgrade to a Microsoft 365 subscription and use the latest Office client applications for optimal compatibility and feature support.
Ensure `office-addin-dev-certs` is installed and run `npx office-addin-dev-certs install` to generate and trust development certificates. For Windows, enable loopbacks via PowerShell: `CheckNetIsolation LoopbackExempt -a -n='microsoft.win32webviewhost_cw5n1h2txyewy'`.
Always execute `npm run stop` (if using Yo Office templates) or `npx office-addin-debugging stop manifest.xml` after a testing session. Manually closing applications is not sufficient to clean up these registrations. Clear the Office cache if problems persist.
Consult the latest Microsoft documentation for recommended debugging approaches for your specific Office host and runtime. This may involve using command-line flags or specific browser developer tools rather than integrated IDE debuggers.
Disable client-side caching in your development web server configuration. You may also need to clear your browser's cache or the Office cache directly.
Run `npx office-addin-dev-certs install` and ensure loopback exemption for WebView2 (`CheckNetIsolation LoopbackExempt -a -n='microsoft.win32webviewhost_cw5n1h2txyewy'` on Windows).
Verify that your add-in manifest is valid, ensure Office is up to date, and temporarily disable antivirus/firewall to rule out interference. Clear the Office cache.
Check the manifest for errors, ensure correct time/date settings on your computer, and verify network access. Reinstall the add-in after verification.