Skip to content

Commit

Permalink
Fix by remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Komissarov committed Mar 27, 2024
1 parent 83a0692 commit 10b4193
Show file tree
Hide file tree
Showing 24 changed files with 144 additions and 157 deletions.
4 changes: 4 additions & 0 deletions DotnetAdapters.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=testadapter/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=testassembly/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=workitem/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
2 changes: 1 addition & 1 deletion Tms.Adapter.Core/Tms.Adapter.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.4.1</Version>
<Version>1.4.2</Version>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.4.1</Version>
<Version>1.4.2</Version>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion Tms.Adapter.XUnit/Tms.Adapter.XUnit.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.4.1</Version>
<Version>1.4.2</Version>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion Tms.Adapter/Tms.Adapter.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.4.1</Version>
<Version>1.4.2</Version>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
Expand Down
11 changes: 6 additions & 5 deletions TmsRunner/Handlers/DiscoveryEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace TmsRunner.Handlers;

public sealed class DiscoveryEventHandler(ILogger<DiscoveryEventHandler> logger,
AutoResetEvent waitHandle) : ITestDiscoveryEventsHandler, IDisposable
EventWaitHandle waitHandle) : ITestDiscoveryEventsHandler, IDisposable
{
private readonly List<TestCase> _discoveredTestCases = [];

Expand All @@ -19,9 +19,10 @@ public void HandleDiscoveredTests(IEnumerable<TestCase>? discoveredTestCases)
return;
}

_discoveredTestCases.AddRange(discoveredTestCases);
var testCases = discoveredTestCases.ToArray();
_discoveredTestCases.AddRange(testCases);

logger.LogDebug("Added test cases: {@TestCases}", discoveredTestCases.Select(t => t.FullyQualifiedName));
logger.LogDebug("Added test cases: {@TestCases}", testCases.Select(t => t.FullyQualifiedName));
}

public void HandleDiscoveryComplete(long totalTests, IEnumerable<TestCase>? lastChunk, bool isAborted)
Expand Down Expand Up @@ -58,7 +59,7 @@ public List<TestCase> GetTestCases()

public void Dispose()
{
_discoveredTestCases?.Clear();
waitHandle?.Dispose();
_discoveredTestCases.Clear();
waitHandle.Dispose();
}
}
12 changes: 6 additions & 6 deletions TmsRunner/Handlers/RunEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace TmsRunner.Handlers;

public sealed class RunEventHandler(ILogger<RunEventHandler> logger, AutoResetEvent waitHandle,
public sealed class RunEventHandler(ILogger<RunEventHandler> logger, EventWaitHandle waitHandle,
ProcessorService processorService) : ITestRunEventsHandler, IDisposable
{
private readonly List<Task> _processTestResultsTasks = [];
Expand All @@ -21,7 +21,7 @@ public void HandleTestRunComplete(TestRunCompleteEventArgs testRunCompleteArgs,
ICollection<AttachmentSet>? runContextAttachments,
ICollection<string>? executorUris)
{
if (lastChunkArgs != null && lastChunkArgs.NewTestResults != null)
if (lastChunkArgs is { NewTestResults: not null })
{
_processTestResultsTasks.Add(ProcessTestResultsAsync(lastChunkArgs.NewTestResults));
}
Expand All @@ -32,7 +32,7 @@ public void HandleTestRunComplete(TestRunCompleteEventArgs testRunCompleteArgs,

public void HandleTestRunStatsChange(TestRunChangedEventArgs? testRunChangedArgs)
{
if (testRunChangedArgs != null && testRunChangedArgs.NewTestResults != null)
if (testRunChangedArgs is { NewTestResults: not null })
{
_processTestResultsTasks.Add(ProcessTestResultsAsync(testRunChangedArgs.NewTestResults));
}
Expand Down Expand Up @@ -67,7 +67,7 @@ public List<Task> GetProcessTestResultsTasks()

private async Task ProcessTestResultsAsync(IEnumerable<TestResult?>? testResults)
{
if (testResults == null || !testResults.Any())
if (testResults == null)
{
return;
}
Expand Down Expand Up @@ -96,7 +96,7 @@ private async Task ProcessTestResultsAsync(IEnumerable<TestResult?>? testResults

public void Dispose()
{
_processTestResultsTasks?.Clear();
waitHandle?.Dispose();
_processTestResultsTasks.Clear();
waitHandle.Dispose();
}
}
30 changes: 15 additions & 15 deletions TmsRunner/Models/AutoTest/AutoTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ namespace TmsRunner.Models.AutoTest;

public sealed record AutoTest
{
public string? Namespace { get; set; }
public string? Classname { get; set; }
public List<AutoTestStep> Steps { get; set; } = [];
public List<AutoTestStep>? Setup { get; set; }
public List<AutoTestStep>? Teardown { get; set; }
public string? ExternalId { get; set; }
public string? Name { get; set; }
public string? Title { get; set; }
public string? Description { get; set; }
public List<string> WorkItemIds { get; set; } = [];
public List<Link>? Links { get; set; } = [];
public List<string>? Labels { get; set; }
public string? MethodName { get; set; }
public string? Message { get; set; }
public bool? IsFlaky { get; set; }
public string? Namespace;
public string? Classname;
public List<AutoTestStep> Steps = [];
public List<AutoTestStep>? Setup;
public List<AutoTestStep>? Teardown;
public string? ExternalId;
public string? Name;
public string? Title;
public string? Description;
public List<string> WorkItemIds = [];
public List<Link>? Links = [];
public List<string>? Labels;
public string? MethodName;
public string? Message;
public bool? IsFlaky;
}
26 changes: 13 additions & 13 deletions TmsRunner/Models/AutoTest/AutoTestResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ namespace TmsRunner.Models.AutoTest;

public sealed record AutoTestResult
{
public List<Link>? Links { get; set; }
public string? Message { get; set; }
public string? ExternalId { get; set; }
public TestOutcome? Outcome { get; set; }
public string? Traces { get; set; }
public DateTime? StartedOn { get; set; }
public DateTime? CompletedOn { get; set; }
public long? Duration { get; set; }
public List<Guid>? Attachments { get; set; }
public Dictionary<string, string>? Parameters { get; set; }
public List<AutoTestStepResult>? StepResults { get; set; }
public List<AutoTestStepResult>? SetupResults { get; set; }
public List<AutoTestStepResult>? TeardownResults { get; set; }
public List<Link>? Links;
public string? Message;
public string? ExternalId;
public TestOutcome? Outcome;
public string? Traces;
public DateTime? StartedOn;
public DateTime? CompletedOn;
public long? Duration;
public List<Guid>? Attachments;
public Dictionary<string, string>? Parameters;
public List<AutoTestStepResult>? StepResults;
public List<AutoTestStepResult>? SetupResults;
public List<AutoTestStepResult>? TeardownResults;
}
6 changes: 3 additions & 3 deletions TmsRunner/Models/AutoTest/AutoTestStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ namespace TmsRunner.Models.AutoTest;

public sealed record AutoTestStep
{
public string? Title { get; set; }
public string? Description { get; set; }
public List<AutoTestStep>? Steps { get; set; }
public string? Title;
public string? Description;
public List<AutoTestStep>? Steps;

public static AutoTestStep ConvertFromStep(Step step)
{
Expand Down
18 changes: 9 additions & 9 deletions TmsRunner/Models/AutoTest/AutoTestStepResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ namespace TmsRunner.Models.AutoTest;

public sealed record AutoTestStepResult
{
public string? Title { get; set; }
public string? Description { get; set; }
public DateTime? StartedOn { get; set; }
public DateTime? CompletedOn { get; set; }
public long? Duration { get; set; }
public List<Guid>? Attachments { get; set; }
public Dictionary<string, string>? Parameters { get; set; }
public List<AutoTestStepResult>? Steps { get; set; }
public string? Outcome { get; set; }
public string? Title;
public string? Description;
public DateTime? StartedOn;
public DateTime? CompletedOn;
public long? Duration;
public List<Guid>? Attachments;
public Dictionary<string, string>? Parameters;
public List<AutoTestStepResult>? Steps;
public string? Outcome;

public static AutoTestStepResult ConvertFromStep(Step step)
{
Expand Down
16 changes: 5 additions & 11 deletions TmsRunner/Models/Configuration/AdapterConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,22 @@ namespace TmsRunner.Models.Configuration;

public sealed class AdapterConfig
{
[Option('r', "runner", Required = true,
HelpText =
"Set path to test runner. Example: --runner '/opt/homebrew/Cellar/dotnet/6.0.110/libexec/sdk/6.0.110/vstest.console.dll'")]
[Option('r', "runner", Required = true, HelpText = "Set path to test runner. Example: --runner '/opt/homebrew/Cellar/dotnet/6.0.110/libexec/sdk/6.0.110/vstest.console.dll'")]
public string? RunnerPath { get; set; }

[Option('t', "testassembly", Required = true,
HelpText = "Set path to test assembly. Example: --testassembly '/Tests/tests.dll'")]
[Option('t', "testassembly", Required = true, HelpText = "Set path to test assembly. Example: --testassembly '/Tests/tests.dll'")]
public string? TestAssemblyPath { get; set; }

[Option('a', "testadapter", Required = false,
HelpText = "Set path to test adapter. Example: --testadapter '/Tests/testsAdapter.dll'")]
[Option('a', "testadapter", Required = false, HelpText = "Set path to test adapter. Example: --testadapter '/Tests/testsAdapter.dll'")]
public string? TestAdapterPath { get; set; }

[Option('l', "logger", Required = false,
HelpText = "Set path to logger. Example: --logger '/Tests/logger.dll'")]
[Option('l', "logger", Required = false, HelpText = "Set path to logger. Example: --logger '/Tests/logger.dll'")]
public string? LoggerPath { get; set; }

[Option("tmsLabelsOfTestsToRun", Required = false, HelpText = "Set labels of autotests to run. Example: --tmsLabelsOfTestsToRun smoke OR --tmsLabelsOfTestsToRun smoke,prod,cloud")]
public string? TmsLabelsOfTestsToRun { get; set; }

[Option('d', "debug", Required = false,
HelpText = "Set debug level for logging. Example: --debug")]
[Option('d', "debug", Required = false, HelpText = "Set debug level for logging. Example: --debug")]
public bool IsDebug { get; set; }

[Option("tmsUrl", Required = false, HelpText = "Set TMS host address.")]
Expand Down
35 changes: 12 additions & 23 deletions TmsRunner/Models/Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,16 @@ namespace TmsRunner.Models.Configuration;

public sealed record Config
{
public string? TmsUrl { get; set; }

public string? TmsPrivateToken { get; set; }

public string? TmsProjectId { get; set; }

public string? TmsConfigurationId { get; set; }

public string? TmsTestRunId { get; set; }

public string? TmsTestRunName { get; set; }

public string? TmsAdapterMode { get; set; }

public string? TmsConfigFile { get; set; }

public string? TmsRunSettings { get; set; }

public string? TmsAutomaticCreationTestCases { get; set; }

public string? TmsCertValidation { get; set; }

public string? TmsLabelsOfTestsToRun { get; set; }
public string? TmsUrl;
public string? TmsPrivateToken;
public string? TmsProjectId;
public string? TmsConfigurationId;
public string? TmsTestRunId;
public string? TmsTestRunName;
public string? TmsAdapterMode;
public string? TmsConfigFile;
public string? TmsRunSettings;
public string? TmsAutomaticCreationTestCases;
public string? TmsCertValidation;
public string? TmsLabelsOfTestsToRun;
}
4 changes: 2 additions & 2 deletions TmsRunner/Models/MessageMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ namespace TmsRunner.Models;

public sealed record MessageMetadata
{
public MessageType Type { get; set; }
public string? Value { get; set; }
public MessageType Type;
public string? Value;
}
8 changes: 4 additions & 4 deletions TmsRunner/Models/MethodMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ namespace TmsRunner.Models;

public sealed record MethodMetadata
{
public string? Name { get; set; }
public string? Namespace { get; set; }
public string? Classname { get; set; }
public List<Attribute>? Attributes { get; set; }
public string? Name;
public string? Namespace;
public string? Classname;
public List<Attribute>? Attributes;
}
19 changes: 9 additions & 10 deletions TmsRunner/Models/Step.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ namespace TmsRunner.Models;

public sealed class Step : StepDto
{
public string? Result { get; set; }
public DateTime? CompletedOn { get; set; }
public long Duration { get; set; }
public List<Step> Steps { get; set; } = [];
public Step? ParentStep { get; set; }
public int NestingLevel { get; set; }
public List<Link> Links { get; set; } = [];
public List<Guid> Attachments { get; set; } = [];
public string? Outcome { get; set; }

public string? Result;
public DateTime? CompletedOn;
public long Duration;
public List<Step> Steps = [];
public Step? ParentStep;
public int NestingLevel;
public List<Link> Links = [];
public List<Guid> Attachments = [];
public string? Outcome;
private string? _stackTrace;

public string StackTrace()
Expand Down
2 changes: 1 addition & 1 deletion TmsRunner/Models/TmsSettings.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace TmsRunner.Models;

public sealed class TmsSettings
public sealed record TmsSettings
{
private string? _url;

Expand Down
Loading

0 comments on commit 10b4193

Please sign in to comment.