Testing Overview
Automated tests run inside a live host so they can work with the active document and host API. RevitDevTool supports Python tests with pytest and .NET tests with Microsoft Testing Platform.
Claimed hosts: Revit and AutoCAD-family (2022–2027). Vertical-specific
--host/HostNamevalues exist for routing; they are not separate product lines.
Choose a Stack
| Stack | Framework | Package | Entry doc |
|---|---|---|---|
| .NET | NUnit 5.0.0 (default), TUnit 1.72.10, or MSTest 4.4.1 | NuGet: RevitDevTool.TestAdapter 0.1.2 | NUnit · TUnit · MSTest |
| CPython | pytest | PyPI: revitdevtool_pytest 0.4.0 | pytest |
| IronPython | unittest (TestCase) | Name files test_*_ipy.py; pytest discovers them as IronPython tests | unittest |
IronPython notes
- Name files
test_*_ipy.pyso the test client recognizes them as IronPython tests. - On Revit, engine preference matches IronPython execution: pyRevit first when installed (default IronPython 2.7.12), else IronPython 3.4.2. AutoCAD-family hosts use bundled IronPython 3.4.2.
- No pytest fixtures, no PEP 723, no debugger for IronPython tests.
- Mixed
test_*.py+test_*_ipy.pyunder oneconftest.pyis fine; separateconftest.pytrees require separate pytest invocations against the same host.
How tests run
The test runner starts or connects to the selected Autodesk application, runs each test with the appropriate Python or .NET runtime, and reports the result back to your terminal or IDE. Tests that modify a document should clean up after themselves and respect the host's transaction rules.
For .NET tests, add the public RevitDevTool.TestAdapter package. It runs NUnit, TUnit, and MSTest inside the host through Microsoft Testing Platform 2.4.1. NUnit is the default. Set TestingFramework to tunit or mstest to opt in. Pin the framework package yourself; the adapter does not pull it.
Leaf Docs
| Doc | Covers |
|---|---|
| pytest | CPython pytest setup, configuration, fixtures, PEP 723, --host table |
| NUnit · TUnit · MSTest | Microsoft Testing Platform project setup, pinned framework packages, CLI and debugger |
Samples: RevitDevTool.PyTest (Python) · DevTools.NUnit.SampleTests, DevTools.TUnit.SampleTests, DevTools.MSTest.SampleTests (.NET)
Troubleshooting: Troubleshooting · bridge connection issues · Known Limitations (IronPython split, sequential runs)