Skip to content

Commit

Permalink
Fixed async steps (#7)
Browse files Browse the repository at this point in the history
Co-authored-by: Dmitry.Gridnev <[email protected]>
  • Loading branch information
testit-owner and Dmitry.Gridnev authored Jun 2, 2023
1 parent 5e86a39 commit 5743f9b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
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.0.2</Version>
<Version>1.0.3</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.0.2</Version>
<Version>1.0.3</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.0.2</Version>
<Version>1.0.3</Version>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
Expand Down
19 changes: 17 additions & 2 deletions TmsRunner/Services/ProcessorService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using AutoMapper;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Serilog;
Expand Down Expand Up @@ -52,7 +53,8 @@ public ProcessorService(
case MessageType.TmsStep:
{
var step = JsonSerializer.Deserialize<Step>(message.Value);
if ((step.CallerMethodType != null && parentStep == null) || (step.CurrentMethodType != null && parentStep == null))
if ((step.CallerMethodType != null && parentStep == null) ||
(step.CurrentMethodType != null && parentStep == null))
{
step.NestingLevel = nestingLevel = 1;
testCaseStepsHierarchical.Add(step);
Expand All @@ -61,7 +63,9 @@ public ProcessorService(
}
else
{
while (parentStep != null && parentStep?.CurrentMethod != step.CallerMethod)
var calledMethod = GetCalledMethod(step.CallerMethod);

while (parentStep != null && parentStep?.CurrentMethod != calledMethod)
{
parentStep = parentStep.ParentStep;
nestingLevel--;
Expand Down Expand Up @@ -205,6 +209,17 @@ public ProcessorService(
return (autoTestSteps, testCaseStepsHierarchical);
}

private static string? GetCalledMethod(string? calledMethod)
{
if (calledMethod == null || !calledMethod.Contains("<")) return calledMethod;

const string pattern = "(?<=\\<)(.*)(?=\\>)";
var regex = new Regex(pattern);
var match = regex.Match(calledMethod);

return match.Groups[1].Value;
}

public async Task ProcessAutoTest(TestResult testResult)
{
var traceJson = GetTraceJson(testResult);
Expand Down
2 changes: 1 addition & 1 deletion TmsRunner/TmsRunner.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.0.2</Version>
<Version>1.0.3</Version>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down

0 comments on commit 5743f9b

Please sign in to comment.