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.

  • pytest
  • NUnit
  • TUnit
  • MSTest
Hosts

Tests run on Revit and the AutoCAD family, 2022–2027. Pick the product with the host settings.

Versions match the latest release

The package versions on these pages are the ones that work with the latest RevitDevTool.


Choose a Stack​

StackFrameworkPackageEntry doc
.NETNUnit 5.0.0 (default), TUnit 1.76.0, or MSTest 4.5.1NuGet: RevitDevTool.TestAdapter 0.1.4NUnit · TUnit · MSTest
CPythonpytestPyPI: revitdevtool_pytest 0.5.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, else IronPython 3.4.2. AutoCAD-family hosts use bundled IronPython 3.4.2.
  • No pytest fixtures and no PEP 723. You can still debug IronPython tests: attach your IDE to the IronPython port before running (Attach Debugger).
  • 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 runner starts or connects to the selected Autodesk application.
  • Each test runs with the matching Python or .NET runtime, and the result comes back to your terminal or IDE.
  • Tests that change a document should clean up after themselves and respect the host's transaction rules.

For .NET tests

  • Add the RevitDevTool.TestAdapter package. It runs NUnit, TUnit and MSTest inside the host through Microsoft Testing Platform 2.5.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.

Host settings​

Every test run needs to know which host to use. The settings are the same for .NET and Python; only where you set them differs.

Setting.NET (.csproj)pytest (CLI / pyproject.toml)MeaningDefault
HostHostName--host / host_nameThe product to test against. Required for .NETrevit for pytest
VersionHostVersion--host-version / host_versionThe Autodesk year. For .NET it must match the API references used to compile the testsnone; required for .NET and with force launch
Fresh hostForceLaunch--force-launch / force_launchStart a new host instead of reusing a running onefalse
Launch timeoutLaunchTimeout--launch-timeout / launch_timeoutSeconds to wait for the host to start180 for .NET, 120 for pytest
Test timeoutPerTestTimeout--per-test-timeout / per_test_timeoutSeconds allowed per test60
Known hostnot available--host-pipe / host_pipeConnect to a specific running host by pipe namenone

Use these values to pick the product:

Product.NET HostNamepytest host_name
RevitRevitrevit
AutoCADAutoCadautocad
Civil 3DCivil3Dcivil3d
Plant 3DPlant3Dplant3d
Map 3DAcadMap3Dacadmap3d
ArchitectureAcadArchacadarch
MechanicalAcadMechacadmech
MEPAcadMepacadmep
ElectricalAcadElecacadelec
Plain AutoCAD

Use AutoCad / autocad for plain AutoCAD, and the product-specific value when you test against a vertical.


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)