Skip to main content

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 / HostName values exist for routing; they are not separate product lines.


Choose a Stack​

StackFrameworkPackageEntry doc
.NETNUnit 5.0.0 (default), TUnit 1.72.10, or MSTest 4.4.1NuGet: RevitDevTool.TestAdapter 0.1.2NUnit · TUnit · MSTest
CPythonpytestPyPI: revitdevtool_pytest 0.4.0pytest
IronPythonunittest (TestCase)Name files test_*_ipy.py; pytest discovers them as IronPython testsunittest

IronPython notes​

  • Name files test_*_ipy.py so 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.py under one conftest.py is fine; separate conftest.py trees 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​

DocCovers
pytestCPython pytest setup, configuration, fixtures, PEP 723, --host table
NUnit · TUnit · MSTestMicrosoft 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)