diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b59bd2..56a24c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.3.2] / 2024-05-09 +### Fixed +- Fix `ApplicationUtils` to clear temp folder after some minutes. (Fix: #41) +- Fix Net Core tests not stay after rebuild. (Fix: #40) +### TestAdapter +- Fix application and rebuild issue. +- Update `ApplicationUtils` to use `Guid` temp folder. + ## [1.3.1] / 2024-04-02 ### Features - Support Revit 2025 to 2017. @@ -401,6 +409,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [x] TestsFail [vNext]: ../../compare/1.0.0...HEAD +[1.3.2]: ../../compare/1.3.1...1.3.2 [1.3.1]: ../../compare/1.3.0...1.3.1 [1.3.0]: ../../compare/1.2.1...1.3.0 [1.2.1]: ../../compare/1.2.0...1.2.1 diff --git a/Directory.Build.props b/Directory.Build.props index 93fa2b8..0b29074 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 1.3.1 + 1.3.2 \ No newline at end of file diff --git a/ricaun.RevitTest.Console/Resources/ricaun.RevitTest.Application.bundle.zip b/ricaun.RevitTest.Console/Resources/ricaun.RevitTest.Application.bundle.zip index 7b7aa22..741d2b9 100644 Binary files a/ricaun.RevitTest.Console/Resources/ricaun.RevitTest.Application.bundle.zip and b/ricaun.RevitTest.Console/Resources/ricaun.RevitTest.Application.bundle.zip differ diff --git a/ricaun.RevitTest.TestAdapter/Resources/net48/ricaun.RevitTest.Console.zip b/ricaun.RevitTest.TestAdapter/Resources/net48/ricaun.RevitTest.Console.zip index 06039be..a32f0c8 100644 Binary files a/ricaun.RevitTest.TestAdapter/Resources/net48/ricaun.RevitTest.Console.zip and b/ricaun.RevitTest.TestAdapter/Resources/net48/ricaun.RevitTest.Console.zip differ diff --git a/ricaun.RevitTest.TestAdapter/Resources/net8.0-windows/ricaun.RevitTest.Console.zip b/ricaun.RevitTest.TestAdapter/Resources/net8.0-windows/ricaun.RevitTest.Console.zip index 47f70b0..a36c56b 100644 Binary files a/ricaun.RevitTest.TestAdapter/Resources/net8.0-windows/ricaun.RevitTest.Console.zip and b/ricaun.RevitTest.TestAdapter/Resources/net8.0-windows/ricaun.RevitTest.Console.zip differ diff --git a/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs b/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs index b89268d..5cfc6ef 100644 --- a/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs +++ b/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs @@ -17,13 +17,19 @@ internal static class ApplicationUtils private static void ClearTemporaryDirectory(string folderDirectory) { + const int MINUTES = 2; try { foreach (var delete in Directory.GetDirectories(folderDirectory)) { try { - Directory.Delete(delete); + var directoryInfo = new DirectoryInfo(delete); + var isTimeToDeleteDirectory = directoryInfo.CreationTime < DateTime.Now.AddMinutes(-MINUTES); + if (isTimeToDeleteDirectory) + { + Directory.Delete(delete, true); + } } catch { } } @@ -44,7 +50,7 @@ public static string CreateTemporaryDirectory(string file = null) ClearTemporaryDirectory(folderDirectory); string fileName = Path.GetFileNameWithoutExtension(file); - string tempFolderName = $"{fileName}_{DateTime.Now.Ticks}"; + string tempFolderName = $"{fileName}_{Guid.NewGuid()}"; string tempDirectory = Path.Combine(folderDirectory, tempFolderName); Directory.CreateDirectory(tempDirectory); return tempDirectory; diff --git a/ricaun.RevitTest.TestAdapter/Services/RevitTestConsole.cs b/ricaun.RevitTest.TestAdapter/Services/RevitTestConsole.cs index 8cd55b4..a938c83 100644 --- a/ricaun.RevitTest.TestAdapter/Services/RevitTestConsole.cs +++ b/ricaun.RevitTest.TestAdapter/Services/RevitTestConsole.cs @@ -27,12 +27,15 @@ private string GetEnvironmentVariable(string applicationPath) return applicationPath; } - private string ValidadeApplication(string applicationPath) + private string ValidadeApplication(string applicationPath, bool showApplicationName = false) { if (string.IsNullOrWhiteSpace(applicationPath)) return null; - AdapterLogger.Logger.InfoAny($"Application: {Path.GetFileName(applicationPath)}"); + if (showApplicationName) + AdapterLogger.Logger.InfoAny($"Application: {Path.GetFileName(applicationPath)}"); + else + AdapterLogger.Logger.Info($"Application: {Path.GetFileName(applicationPath)}"); applicationPath = GetEnvironmentVariable(applicationPath); @@ -60,7 +63,7 @@ private string ValidadeApplication(string applicationPath) public RevitTestConsole(string application = null) { - applicationPath = ValidadeApplication(application); + applicationPath = ValidadeApplication(application, true); if (applicationPath is null) { var name = ResourceConsoleUtils.Name; diff --git a/ricaun.RevitTest.TestAdapter/TestCaseUtils.cs b/ricaun.RevitTest.TestAdapter/TestCaseUtils.cs index 6d87df7..00020a7 100644 --- a/ricaun.RevitTest.TestAdapter/TestCaseUtils.cs +++ b/ricaun.RevitTest.TestAdapter/TestCaseUtils.cs @@ -26,7 +26,6 @@ public static TestCase Create(string source, string testName) var testCase = new TestCase(fullyQualifiedName, TestAdapter.ExecutorUri, source) { DisplayName = displayName, - Id = GetGuid(testName), }; return testCase; @@ -53,11 +52,6 @@ private static int LastIndexOfDisplayName(string testName) return lastIndexOfDot; } - private static System.Guid GetGuid(string testName) - { - return new System.Guid(testName.GetHashCode(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } - #endregion } } \ No newline at end of file diff --git a/ricaun.RevitTest.TestAdapter/TestDiscoverer.cs b/ricaun.RevitTest.TestAdapter/TestDiscoverer.cs index ff41a3b..56c04ad 100644 --- a/ricaun.RevitTest.TestAdapter/TestDiscoverer.cs +++ b/ricaun.RevitTest.TestAdapter/TestDiscoverer.cs @@ -80,9 +80,10 @@ internal static List GetTests( foreach (var testName in testNames) { - AdapterLogger.Logger.Info($"TestCase: {testName}"); var testCase = TestCaseUtils.Create(source, testName); + AdapterLogger.Logger.Info($"TestCase: {testCase} [{testCase.DisplayName}] \t{testCase.Id}"); + discoverySink?.SendTestCase(testCase); tests.Add(testCase); } diff --git a/ricaun.RevitTest.TestAdapter/TestExecutor.cs b/ricaun.RevitTest.TestAdapter/TestExecutor.cs index aca227a..6139d6f 100644 --- a/ricaun.RevitTest.TestAdapter/TestExecutor.cs +++ b/ricaun.RevitTest.TestAdapter/TestExecutor.cs @@ -164,13 +164,13 @@ await revit.RunTestAction(source, private static void RecordResultTestModel(IFrameworkHandle frameworkHandle, string source, List tests, TestModel testModel) { TestCase testCase = TryFindSimilarTestCaseUsingTestModel(tests, testModel); - - if (testCase is null) + var needToCreateTestCase = testCase is null; + if (needToCreateTestCase) { testCase = TestCaseUtils.Create(source, testModel.FullName); } - AdapterLogger.Logger.Info($"\tTestCase: {testCase} [{testCase.DisplayName}]"); + AdapterLogger.Logger.Info($"\tTestCase: {testCase} [{testCase.DisplayName}] \t{testCase.Id}"); var testResult = new TestResult(testCase);