Skip to content
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

Version 1.3.2 #42

Merged
merged 6 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>1.3.1</Version>
<Version>1.3.2</Version>
</PropertyGroup>
</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 8 additions & 2 deletions ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
}
Expand All @@ -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;
Expand Down
9 changes: 6 additions & 3 deletions ricaun.RevitTest.TestAdapter/Services/RevitTestConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down
6 changes: 0 additions & 6 deletions ricaun.RevitTest.TestAdapter/TestCaseUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
}
}
3 changes: 2 additions & 1 deletion ricaun.RevitTest.TestAdapter/TestDiscoverer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ internal static List<TestCase> 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);
}
Expand Down
6 changes: 3 additions & 3 deletions ricaun.RevitTest.TestAdapter/TestExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ await revit.RunTestAction(source,
private static void RecordResultTestModel(IFrameworkHandle frameworkHandle, string source, List<TestCase> 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);

Expand Down