-
Notifications
You must be signed in to change notification settings - Fork 201
REVIT-238057: Add OOTB D4R sample smoke tests #3388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Fusneica-FlorentinCristian
wants to merge
17
commits into
master
Choose a base branch
from
fusneif/REVIT-238057/tests-for-OOTB-sample-scripts-D4R
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+287
−0
Open
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7abf66c
REVIT-238057: Add OOTB D4R sample tests with SetupUnzip
Fusneica-FlorentinCristian 0ee962e
Merge remote-tracking branch 'origin/master' into fusneif/REVIT-23805…
Fusneica-FlorentinCristian bddc280
REVIT-238057: Address PR review — refactor OOTB_D4R_Tests
Fusneica-FlorentinCristian 7288c0c
REVIT-238057: Update .gitignore to include packages directory
Fusneica-FlorentinCristian 6609d64
Add logs directory to .gitignore to prevent tracking log files
Fusneica-FlorentinCristian c2df5c8
REVIT-238057: Add explicit using System for InvalidOperationException
Fusneica-FlorentinCristian b5eb9d0
REVIT-238057: Update OOTB D4R sample tests to use correct models per …
Fusneica-FlorentinCristian ce36648
Merge remote-tracking branch 'origin/master' into fusneif/REVIT-23805…
Fusneica-FlorentinCristian a50d36f
Address PR feedback: rename class, add node warning check, extract to…
Fusneica-FlorentinCristian 1a90684
Fix test model paths to use models available in repo
Fusneica-FlorentinCristian 47393d0
Use version-keyed temp cache with atomic extraction
Fusneica-FlorentinCristian 6e76992
Add cache fallback when zip is absent
Fusneica-FlorentinCristian db46fcb
Comment out zip extraction priorities, keep for future use
Fusneica-FlorentinCristian d4b045b
Rename SetupUnzip to ResolveSamplePath, add locale probe, sort diagno…
Fusneica-FlorentinCristian 7c2d132
Fix double semicolon, add comment clarifying SamplesPath distinction
Fusneica-FlorentinCristian 81dcef8
Add graph-loaded assertion, clarify assembly location pattern
Fusneica-FlorentinCristian 2609aac
Improve assertion diagnostics: show node messages and connector details
Fusneica-FlorentinCristian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
233 changes: 233 additions & 0 deletions
233
test/Libraries/RevitIntegrationTests/OOTB_D4R_SampleTests.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,233 @@ | ||
| using System.IO; | ||
| using System.IO.Compression; | ||
| using System.Linq; | ||
| using System.Reflection; | ||
| using NUnit.Framework; | ||
| using RevitTestServices; | ||
| using RTF.Framework; | ||
|
|
||
| namespace RevitSystemTests | ||
| { | ||
| /// <summary> | ||
| /// Tests for the Out-of-the-Box (OOTB) D4R sample scripts shipped as part of the | ||
| /// revit-d4r-content-samples artifact. | ||
| /// | ||
| /// The .dyn files are resolved at runtime via <see cref="SetupUnzip"/> which checks, | ||
| /// in order: | ||
| /// 1. An already-extracted D4RSamples folder next to the installed samples directory. | ||
| /// 2. A revit-d4r-content-samples-*-net10.zip in the installed samples directory. | ||
| /// 3. The already-deployed samples at DynamoForRevit\samples\en-US\Revit\. | ||
| /// </summary> | ||
| [TestFixture] | ||
| class OOTB_D4R_Tests : RevitSystemTestBase | ||
| { | ||
| /// <summary> | ||
| /// Locates an OOTB sample .dyn file by checking the standard deployment locations | ||
| /// used for the revit-d4r-content-samples artifact. | ||
| /// </summary> | ||
| /// <param name="scriptFileName"> | ||
| /// The filename of the .dyn script as shipped, e.g. "Revit Color.dyn". | ||
| /// </param> | ||
| /// <returns>Absolute path to the .dyn file.</returns> | ||
| public static string SetupUnzip(string scriptFileName) | ||
|
Fusneica-FlorentinCristian marked this conversation as resolved.
Outdated
|
||
| { | ||
| string assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); | ||
|
Fusneica-FlorentinCristian marked this conversation as resolved.
|
||
|
|
||
| // When deployed to Revit: | ||
| // assemblyDir = DynamoForRevit\Revit\ | ||
| // parentDir = DynamoForRevit\ | ||
| string parentDir = Path.GetDirectoryName(assemblyDir); | ||
|
|
||
| string samplesFolder = Path.Combine(parentDir, "samples"); | ||
|
Fusneica-FlorentinCristian marked this conversation as resolved.
|
||
| string extractedSamplesPath = Path.Combine(samplesFolder, "D4RSamples"); | ||
| string installedSamplesPath = Path.Combine(samplesFolder, @"en-US\Revit"); | ||
|
|
||
|
Fusneica-FlorentinCristian marked this conversation as resolved.
|
||
| // Priority 1: zip was already extracted from a previous test run | ||
| if (Directory.Exists(extractedSamplesPath)) | ||
| { | ||
| return Path.Combine(extractedSamplesPath, @"Samples\en-US\Revit", scriptFileName); | ||
| } | ||
|
Fusneica-FlorentinCristian marked this conversation as resolved.
Outdated
|
||
|
|
||
|
Fusneica-FlorentinCristian marked this conversation as resolved.
|
||
| // Priority 2: zip file is present — extract on first use | ||
| if (Directory.Exists(samplesFolder)) | ||
| { | ||
| var zipFiles = Directory.GetFiles( | ||
| samplesFolder, | ||
| "revit-d4r-content-samples-*-net10.zip"); | ||
|
|
||
| if (zipFiles.Length > 0) | ||
| { | ||
| ZipFile.ExtractToDirectory(zipFiles[0], extractedSamplesPath); | ||
| return Path.Combine(extractedSamplesPath, @"Samples\en-US\Revit", scriptFileName); | ||
| } | ||
|
Fusneica-FlorentinCristian marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| // Priority 3: already-deployed samples (standard Revit install) | ||
| if (Directory.Exists(installedSamplesPath)) | ||
| { | ||
| return Path.Combine(installedSamplesPath, scriptFileName); | ||
| } | ||
|
|
||
| // Provide a useful diagnostic message to help locate the issue | ||
| if (Directory.Exists(samplesFolder)) | ||
| { | ||
| var entries = Directory.EnumerateFileSystemEntries(samplesFolder) | ||
| .Select(e => $"\n {e}"); | ||
| throw new DirectoryNotFoundException( | ||
| $"Cannot locate OOTB D4R sample scripts.\n" + | ||
| $"Checked samples folder: {samplesFolder}\n" + | ||
| $"Contents:{string.Concat(entries)}"); | ||
|
Fusneica-FlorentinCristian marked this conversation as resolved.
|
||
| } | ||
| else | ||
| { | ||
| var parentEntries = Directory.Exists(parentDir) | ||
| ? Directory.EnumerateDirectories(parentDir).Select(e => $"\n {e}") | ||
| : Enumerable.Empty<string>(); | ||
| throw new DirectoryNotFoundException( | ||
| $"Cannot locate OOTB D4R sample scripts.\n" + | ||
| $"Expected samples folder not found: {samplesFolder}\n" + | ||
| $"Parent dir contents:{string.Concat(parentEntries)}"); | ||
| } | ||
| } | ||
|
|
||
| [Test, Category("SmokeTests")] | ||
| [TestModel(@".\empty.rfa")] | ||
| public void Revit_Geometry_Creation_Points() | ||
| { | ||
| string samplePath = SetupUnzip("Revit Geometry Creation Points.dyn"); | ||
| string testPath = Path.GetFullPath(samplePath); | ||
|
|
||
| ViewModel.OpenCommand.Execute(testPath); | ||
|
|
||
| AssertNoDummyNodes(); | ||
|
|
||
| RunCurrentModel(); | ||
| } | ||
|
Fusneica-FlorentinCristian marked this conversation as resolved.
Outdated
|
||
|
|
||
| [Test, Category("SmokeTests")] | ||
| [TestModel(@".\empty.rfa")] | ||
| public void Revit_Geometry_Creation_Curves() | ||
| { | ||
| string samplePath = SetupUnzip("Revit Geometry Creation Curves.dyn"); | ||
| string testPath = Path.GetFullPath(samplePath); | ||
|
|
||
| ViewModel.OpenCommand.Execute(testPath); | ||
|
|
||
| AssertNoDummyNodes(); | ||
|
|
||
| RunCurrentModel(); | ||
| } | ||
|
|
||
| [Test, Category("SmokeTests")] | ||
| [TestModel(@".\empty.rfa")] | ||
| public void Revit_Geometry_Creation_Solids() | ||
| { | ||
| string samplePath = SetupUnzip("Revit Geometry Creation Solids.dyn"); | ||
| string testPath = Path.GetFullPath(samplePath); | ||
|
|
||
| ViewModel.OpenCommand.Execute(testPath); | ||
|
|
||
| AssertNoDummyNodes(); | ||
|
|
||
| RunCurrentModel(); | ||
| } | ||
|
|
||
| [Test, Category("SmokeTests")] | ||
| [TestModel(@".\empty.rfa")] | ||
| public void Revit_Geometry_Creation_Surfaces() | ||
| { | ||
| string samplePath = SetupUnzip("Revit Geometry Creation Surfaces.dyn"); | ||
| string testPath = Path.GetFullPath(samplePath); | ||
|
|
||
| ViewModel.OpenCommand.Execute(testPath); | ||
|
|
||
| AssertNoDummyNodes(); | ||
|
|
||
| RunCurrentModel(); | ||
| } | ||
|
|
||
| [Test, Category("SmokeTests")] | ||
| [TestModel(@".\Samples\DynamoSample_2021.rvt")] | ||
| public void Revit_Adaptive_Component_Placement() | ||
| { | ||
| string samplePath = SetupUnzip("Revit Adaptive Component Placement.dyn"); | ||
| string testPath = Path.GetFullPath(samplePath); | ||
|
|
||
| ViewModel.OpenCommand.Execute(testPath); | ||
|
|
||
| AssertNoDummyNodes(); | ||
|
|
||
| RunCurrentModel(); | ||
| } | ||
|
|
||
| [Test, Category("SmokeTests")] | ||
| [TestModel(@".\Samples\DynamoSample_2021.rvt")] | ||
| public void Revit_Color() | ||
|
Fusneica-FlorentinCristian marked this conversation as resolved.
|
||
| { | ||
| string samplePath = SetupUnzip("Revit Color.dyn"); | ||
| string testPath = Path.GetFullPath(samplePath); | ||
|
|
||
| ViewModel.OpenCommand.Execute(testPath); | ||
|
|
||
| AssertNoDummyNodes(); | ||
|
|
||
| RunCurrentModel(); | ||
| } | ||
|
|
||
| [Test, Category("SmokeTests")] | ||
| [TestModel(@".\Samples\DynamoSample_2021.rvt")] | ||
| public void Revit_Floors_and_Framing() | ||
| { | ||
| string samplePath = SetupUnzip("Revit Floors and Framing.dyn"); | ||
| string testPath = Path.GetFullPath(samplePath); | ||
|
|
||
| ViewModel.OpenCommand.Execute(testPath); | ||
|
|
||
| AssertNoDummyNodes(); | ||
|
|
||
| RunCurrentModel(); | ||
| } | ||
|
|
||
| [Test, Category("SmokeTests")] | ||
| [TestModel(@".\Samples\DynamoSample_2021.rvt")] | ||
| public void Revit_Import_Solid() | ||
| { | ||
| string samplePath = SetupUnzip("Revit Import Solid.dyn"); | ||
| string testPath = Path.GetFullPath(samplePath); | ||
|
|
||
| ViewModel.OpenCommand.Execute(testPath); | ||
|
|
||
| AssertNoDummyNodes(); | ||
|
|
||
| RunCurrentModel(); | ||
| } | ||
|
|
||
| [Test, Category("SmokeTests")] | ||
| [TestModel(@".\Samples\DynamoSample_2021.rvt")] | ||
| public void Revit_Place_Families_By_Level_Set_Parameters() | ||
| { | ||
| string samplePath = SetupUnzip("Revit Place Families By Level Set Parameters.dyn"); | ||
| string testPath = Path.GetFullPath(samplePath); | ||
|
|
||
| ViewModel.OpenCommand.Execute(testPath); | ||
|
|
||
| AssertNoDummyNodes(); | ||
|
|
||
| RunCurrentModel(); | ||
| } | ||
|
|
||
| [Test, Category("SmokeTests")] | ||
| [TestModel(@".\Samples\DynamoSample_2021.rvt")] | ||
| public void Revit_Structural_Framing() | ||
|
Fusneica-FlorentinCristian marked this conversation as resolved.
|
||
| { | ||
| string samplePath = SetupUnzip("Revit Structural Framing.dyn"); | ||
| string testPath = Path.GetFullPath(samplePath); | ||
|
|
||
| ViewModel.OpenCommand.Execute(testPath); | ||
|
|
||
| AssertNoDummyNodes(); | ||
|
|
||
| RunCurrentModel(); | ||
| } | ||
| } | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.