Skip to content

Commit

Permalink
Update Timeout to double
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Dec 9, 2024
1 parent 6710e20 commit 7007c28
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Update to use `Task.Run` to force run outside the Revit context.
### Command
- Update `AssemblyName` to use `Version`.
- Update `Timeout` to `double`.
### TestAdapter
- Update `MapperKey` to multiple converts.
- Update `MetadataMapper` with `prefix`.
- Fix `Mapper` convert integer to ignore dot.
- Update `Timeout` to `double`.

## [1.7.0] / 2024-11-02 - 2024-12-03
### Features
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.7.1-alpha.4</Version>
<Version>1.7.1-beta</Version>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion ricaun.RevitTest.Command/Command/IRunTestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public bool RunTests(
string forceLanguageToRevit = null,
bool forceToOpenNewRevit = false,
bool forceToCloseRevit = false,
int timeoutMinutes = 0,
double timeoutMinutes = 0,
params string[] testFilters);
}
}
2 changes: 1 addition & 1 deletion ricaun.RevitTest.Command/Command/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static Parser CreateParser()
[Option("timeout",
Default = 0,
HelpText = "Timeout in minutes to abort this application.")]
public int Timeout { get; set; }
public double Timeout { get; set; }

[Option("debugger",
Default = false,
Expand Down
2 changes: 1 addition & 1 deletion ricaun.RevitTest.Command/Process/RevitTestProcessStart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public RevitTestProcessStart SetClose(bool close = true)
if (!close) return this;
return SetRevitArgument("close");
}
public RevitTestProcessStart SetTimeout(int timeoutMinutes) => SetRevitArgument("timeout", timeoutMinutes);
public RevitTestProcessStart SetTimeout(double timeoutMinutes) => SetRevitArgument("timeout", timeoutMinutes);
public RevitTestProcessStart SetTestFilter(string[] testFilters)
{
if (testFilters.Length == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static async Task RunExecuteTests(
string language = null,
bool revitOpen = false,
bool revitClose = false,
int timeoutMinutes = 0,
double timeoutMinutes = 0,
bool debugger = false,
Action<string> consoleAction = null,
Action<string> debugAction = null,
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion ricaun.RevitTest.Console/Revit/RevitRunTestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public bool RunTests(string fileToTest,
string forceLanguageToRevit = null,
bool forceToOpenNewRevit = false,
bool forceToCloseRevit = false,
int timeoutMinutes = 0,
double timeoutMinutes = 0,
params string[] testFilters)
{
RevitTestUtils.CreateRevitServer(
Expand Down
8 changes: 4 additions & 4 deletions ricaun.RevitTest.Console/Revit/Utils/RevitTestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static void CreateRevitServer(
string forceLanguageToRevit = null,
bool forceToOpenNewRevit = false,
bool forceToCloseRevit = false,
int timeoutMinutes = 0,
double timeoutMinutes = 0,
params string[] testFilters)
{
int timeoutNotBusyCountMax = 10;
Expand Down Expand Up @@ -198,14 +198,14 @@ public static void CreateRevitServer(
}
};

var timeoutSeconds = timeoutMinutes * 60;
int timeoutSeconds = (int) timeoutMinutes * 60;
for (int i = 0; i <= timeoutSeconds; i++)
{
Thread.Sleep(1000);

if (i % 30 == 0 && i > 0)
{
Log.WriteLine($"{revitInstallation}: Execution time is {i / 60.0} minutes, maximum {timeoutMinutes} minutes.");
Log.WriteLine($"{revitInstallation}: Execution time is {i / 60.0} minutes, maximum {timeoutMinutes:0.0} minutes.");
}

if (process.HasExited) break;
Expand Down Expand Up @@ -237,7 +237,7 @@ public static void CreateRevitServer(

if (timeoutForceToEnd)
{
var timeoutMessage = $"RevitTest: Timeout {timeoutMinutes} minutes.";
var timeoutMessage = $"RevitTest: Timeout {timeoutMinutes:0.0} minutes.";
Log.WriteLine($"{revitInstallation}: {timeoutMessage}");
var exceptionTimeoutTests = new Exception(timeoutMessage);
var timeoutTests = TestEngine.Fail(fileToTest, exceptionTimeoutTests, testFilters);
Expand Down
2 changes: 1 addition & 1 deletion ricaun.RevitTest.TestAdapter/Models/RunSettingsModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class NUnitModel
public bool Close { get; set; }

[XmlElement("Timeout")]
public int Timeout { get; set; }
public double Timeout { get; set; }

[XmlElement("Verbosity")]
public int Verbosity { get; set; }
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion ricaun.RevitTest.TestAdapter/Services/RevitTestConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public async Task RunExecuteTests(
string language = null,
bool revitOpen = false,
bool revitClose = false,
int timeoutMinutes = 0,
double timeoutMinutes = 0,
Action<string> consoleAction = null,
Action<string> debugAction = null,
Action<string> errorAction = null,
Expand Down
4 changes: 2 additions & 2 deletions ricaun.RevitTest.Tests/TestsDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

//[assembly: AssemblyMetadata("NUnit.Application", "..\\..\\..\\..\\ricaun.RevitTest.Console\\bin\\Debug\\ricaun.DA4R.NUnit.Console.zip")]

[assembly: AssemblyMetadata("NUnit.Timeout", "5.0")]

//[assembly: AssemblyMetadata("NUnit.Language", "ENU /hosted")]
#endif

[assembly: AssemblyMetadata("NUnit.Timeout", "5.5")]

namespace ricaun.RevitTest.Tests
{
#if DEBUG
Expand Down

0 comments on commit 7007c28

Please sign in to comment.