REVIT-238057: Add OOTB D4R sample smoke tests#3388
Open
Fusneica-FlorentinCristian wants to merge 17 commits into
Open
REVIT-238057: Add OOTB D4R sample smoke tests#3388Fusneica-FlorentinCristian wants to merge 17 commits into
Fusneica-FlorentinCristian wants to merge 17 commits into
Conversation
Add OOTB_D4R_SampleTests.cs to RevitIntegrationTests with: - SetupUnzip() that resolves .dyn files from: 1. Previously-extracted D4RSamples folder 2. revit-d4r-content-samples-*-net10.zip in DynamoForRevit\samples 3. Already-deployed DynamoForRevit\samples\en-US\Revit (fallback) - Smoke tests for all 10 OOTB sample scripts - Geometry tests (Points, Curves, Solids, Surfaces) use empty.rfa - Revit-element tests use DynamoSample_2021.rvt
…7/tests-for-OOTB-sample-scripts-D4R
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Revit integration test fixture to validate that the OOTB D4R sample graphs can be located (including from a shipped ZIP) and executed as smoke tests.
Changes:
- Introduces
SetupUnzipto resolve OOTB D4R sample.dynfiles via extracted folder, ZIP artifact, or installed samples fallback. - Adds 10 smoke tests that open and run each OOTB D4R sample graph (geometry + Revit-element graphs with appropriate test models).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Make SetupUnzip private (not needed outside the fixture) - Add File.Exists checks on resolved paths before returning - Throw on multiple matching zip files (ambiguous source) - Extract OpenAndRunSample helper to reduce duplication in 10 tests - Use FileNotFoundException for missing scripts (more specific)
Fixes CS0122 build error where InvalidOperationException was inaccessible without explicit System namespace import.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…7/tests-for-OOTB-sample-scripts-D4R
… temp - Rename class to OOTB_D4R_SampleTests (matches filename) - Reorder SetupUnzip priorities: installed samples first - Extract zip to %TEMP%\D4RSamples instead of install dir - Use overwriteFiles:true for re-extraction robustness - Add post-run assertion: fail if any node is in Error/Warning state
- Replace Snowdon Towers (not in repo) with SampleModel.rvt, empty.rfa, AdaptiveComponents.rfa, StructuralFraming.rvt as appropriate - Replace ConceptualMass.rfa (not in repo) with MassWithBoxAndCone.rfa - All referenced models now exist under test/System/
- Derive cache folder from zip filename (invalidates on version change) - Extract to staging dir, move atomically into place - Clean up staging on failure for self-healing retry - Simplify to 2 priorities: installed samples, then zip cache
Scan existing %TEMP%\D4RSamples\ subdirectories (most recent first) as priority 3, so a previously extracted cache remains usable even after the source zip is removed.
Only the installed samples path is active (priority 1). Zip-based extraction (priorities 2/3) is preserved as commented code in a #region block for potential future enablement.
…stics - Rename method since zip code is commented out (clearer intent) - Probe CurrentUICulture locale first, then fall back to en-US - Sort directory listing in diagnostic exceptions for determinism
- Remove extra trailing semicolon after throw statement - Add comment explaining why we use assembly-relative path instead of base class SamplesPath (D4R OOTB samples vs doc/distrib/Samples)
- Assert CurrentWorkspace.Nodes.Any() after OpenCommand to catch load failures - Add comment explaining GetExecutingAssembly() is the standard test pattern used throughout RevitSystemTestBase/SystemTest/CoreTests/RegressionTests
- Use NodeInfos to surface actual error/warning messages per node - Include node type name for easier identification - Report connector GUID and Start/End port details for broken connectors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add OOTB_D4R_SampleTests.cs to RevitIntegrationTests with:\n- ResolveSamplePath() that resolves .dyn files from the already-deployed samples\n at DynamoForRevit\samples\{locale}\Revit\ (probes current UI culture then en-US fallback)\n- Commented-out zip-based extraction (priorities 2/3) kept for future use\n- OpenAndRunSample() helper with post-run node error/warning assertion\n- Smoke tests for all 10 OOTB sample scripts\n- Test models: empty.rfa (Points, Curves), MassWithBoxAndCone.rfa (Solids, Surfaces),\n AdaptiveComponents.rfa (Adaptive Placement), SampleModel.rvt (Color, Floors,\n Import Solid, Place Families), StructuralFraming\StructuralFraming.rvt (Structural Framing)