diff --git a/src/Framework/Runner/Interfaces.cs b/src/Framework/Runner/Interfaces.cs index 5b1ef094..51178bce 100644 --- a/src/Framework/Runner/Interfaces.cs +++ b/src/Framework/Runner/Interfaces.cs @@ -85,6 +85,7 @@ public interface IRunnerSetupData bool IsTesting { get; set; } string ExcludedCategory { get; set; } int SelectedProduct { get; set; } + string AdditionalResolutionDirectories { get; set; } } public interface IRunner diff --git a/src/Framework/Runner/Runner.cs b/src/Framework/Runner/Runner.cs index 2cf43970..1670430c 100644 --- a/src/Framework/Runner/Runner.cs +++ b/src/Framework/Runner/Runner.cs @@ -378,8 +378,6 @@ public Runner() /// public Runner(IRunnerSetupData setupData) { - AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += CurrentDomain_ReflectionOnlyAssemblyResolve; - if (!String.IsNullOrEmpty(setupData.TestAssembly) && !File.Exists(setupData.TestAssembly)) { throw new ArgumentException("The specified test assembly does not exist."); @@ -428,6 +426,20 @@ public Runner(IRunnerSetupData setupData) IsTesting = setupData.IsTesting; ExcludedCategory = setupData.ExcludedCategory; + if(!string.IsNullOrEmpty(setupData.AdditionalResolutionDirectories)) + { + var splits = setupData.AdditionalResolutionDirectories.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); + if (!splits.Any()) return; + + this.AdditionalResolutionDirectories.Clear(); + foreach (var split in splits) + { + this.AdditionalResolutionDirectories.Add(split); + } + } + var resolver = new DefaultAssemblyResolver(RevitPath, AdditionalResolutionDirectories); + AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += resolver.Resolve; + Initialize(); } @@ -1784,6 +1796,7 @@ public static IRunnerSetupData ParseCommandLineArguments(IEnumerable arg {"exclude:", "The name of a test category to exclude. This has a higher priortiy than other settings. If a specified category is set here, any test cases that belongs to that category will not be run. (OPTIONAL)", v=> setupData.ExcludedCategory = v}, {"c|concatenate", "Concatenate the results from this run of RTF with an existing results file if one exists at the path specified. The default behavior is to replace the existing results file. (OPTIONAL)", v=> setupData.Concat = v != null}, {"revit:", "The Revit executable to be used for testing. If no executable is specified, RTF will use the first version of Revit that is found on the machine using the RevitAddinUtility. (OPTIONAL)", v=> setupData.RevitPath = v}, + {"add:", @"Additional path resolution directories as a string separated by ';'", v=>setupData.AdditionalResolutionDirectories=v}, {"copyAddins", "Specify whether to copy the addins from the Revit folder to the current working directory. Copying the addins from the Revit folder will cause the test process to simulate the typical setup on your machine. (OPTIONAL)", v=> setupData.CopyAddins = v != null}, {"dry", "Conduct a dry run. (OPTIONAL)", v=> setupData.DryRun = v != null}, diff --git a/src/Framework/Runner/RunnerSetupData.cs b/src/Framework/Runner/RunnerSetupData.cs index ba706745..b06c3eca 100644 --- a/src/Framework/Runner/RunnerSetupData.cs +++ b/src/Framework/Runner/RunnerSetupData.cs @@ -29,6 +29,7 @@ public class RunnerSetupData : IRunnerSetupData public bool CopyAddins { get; set; } public bool IsTesting { get; set; } public int SelectedProduct { get; set; } + public string AdditionalResolutionDirectories { get; set; } public RunnerSetupData() { diff --git a/tools/Output/RevitTestFrameworkInstaller2017.exe b/tools/Output/RevitTestFrameworkInstaller2017.exe index 7ed5455d..00f00a01 100644 Binary files a/tools/Output/RevitTestFrameworkInstaller2017.exe and b/tools/Output/RevitTestFrameworkInstaller2017.exe differ