NasAmin / trx-parser

This repository contains a Typescript GitHub action for parsing trx files and creating status check for each trx file based on its test outcome
MIT License
15 stars 16 forks source link

Version 0.4.0 doesn't parse test outcome as expected #292

Closed marcwittke closed 1 year ago

marcwittke commented 1 year ago

This is the output of v0.3.0 image

And this is the same broken test result parsed with v0.4.0 image

NasAmin commented 1 year ago

@marcwittke do you mind providing the trx file please so I can reproduce?

marcwittke commented 1 year ago

Sure. Don't have the original artifact from the build agent any more, but this should be an equal result file:

<?xml version="1.0" encoding="utf-8"?>
<TestRun id="df40dbb5-4bff-4eca-8def-c4fb9082dc11" name="@mw-ryzen5900x 2023-08-16 07:58:43" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
  <Times creation="2023-08-16T07:58:43.6378233-03:00" queuing="2023-08-16T07:58:43.6378233-03:00" start="2023-08-16T07:58:33.9911469-03:00" finish="2023-08-16T07:59:04.4545540-03:00" />
  <TestSettings name="default" id="017ddb06-e0f3-4131-b2ee-d8db640194c6">
    <Deployment runDeploymentRoot="_mw-ryzen5900x_2023-08-16_07_58_43" />
  </TestSettings>
  <Results>
    <UnitTestResult executionId="21249158-8833-41e2-9251-f69d5e856068" testId="0a0bf1af-b8d3-5268-8c36-2463eacd91a2" testName="Mep.Runtime.Tests.TheMepApplication.CanCreateDemoTenant" computerName="mw-ryzen5900x" duration="00:00:14.5824843" startTime="2023-08-16T07:58:59.6124396-03:00" endTime="2023-08-16T07:58:59.6124407-03:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="21249158-8833-41e2-9251-f69d5e856068" />
    <UnitTestResult executionId="471c8012-605a-4654-8cb3-65fba9e70821" testId="ef20c9ad-170e-483a-ee42-209907cd0b18" testName="Mep.Runtime.Tests.TheMepApplication.CanCreateProductiveTenant" computerName="mw-ryzen5900x" duration="00:00:02.2567979" startTime="2023-08-16T07:59:04.3884320-03:00" endTime="2023-08-16T07:59:04.3884321-03:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Failed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="471c8012-605a-4654-8cb3-65fba9e70821">
      <Output>
        <ErrorInfo>
          <Message>Assert.False() Failure
Expected: False
Actual:   True</Message>
          <StackTrace>   at Mep.Runtime.Tests.TheMepApplication.&lt;&gt;c.&lt;CanCreateProductiveTenant&gt;b__5_1(IInstanceProvider ip) in /home/marcwittke/code/mep/backend/tests/Mep.Runtime.Tests/TheMepApplication.cs:line 69
   at Backend.Fx.Patterns.DependencyInjection.BackendFxApplicationInvoker.Invoke(Action`1 action, IIdentity identity, TenantId tenantId, Nullable`1 correlationId)
   at Backend.Fx.Patterns.DependencyInjection.ExceptionLoggingInvoker.Invoke(Action`1 action, IIdentity identity, TenantId tenantId, Nullable`1 correlationId)
   at Mep.Runtime.Tests.TheMepApplication.CanCreateProductiveTenant() in /home/marcwittke/code/mep/backend/tests/Mep.Runtime.Tests/TheMepApplication.cs:line 66</StackTrace>
        </ErrorInfo>
      </Output>
    </UnitTestResult>
    <UnitTestResult executionId="b182209b-7270-4bee-98fa-3d661c23ae0d" testId="76eac0cb-41bd-4375-b9c3-3c1f9b66cd91" testName="Mep.Runtime.Tests.TheDatabaseMigration.CanMigrateAnEmptySchema" computerName="mw-ryzen5900x" duration="00:00:04.7827101" startTime="2023-08-16T07:58:43.6047023-03:00" endTime="2023-08-16T07:58:43.6047265-03:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="b182209b-7270-4bee-98fa-3d661c23ae0d">
      <Output>
        <StdOut>[07:58:43 WRN] Saving changes failed due to an arbitrary database exception
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---&gt; Npgsql.PostgresException (0x80004005): 23505: duplicate key value violates unique constraint "ix_turns_language_code_shift_id_route_id"

DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.
   at Npgsql.Internal.NpgsqlConnector.&lt;ReadMessage&gt;g__ReadMessageLong|215_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
   at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
   at Npgsql.NpgsqlDataReader.NextResult()
   at Npgsql.EntityFrameworkCore.PostgreSQL.Update.Internal.NpgsqlModificationCommandBatch.Consume(RelationalDataReader reader)
  Exception data:
    Severity: ERROR
    SqlState: 23505
    MessageText: duplicate key value violates unique constraint "ix_turns_language_code_shift_id_route_id"
    Detail: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.
    SchemaName: mep
    TableName: turns
    ConstraintName: ix_turns_language_code_shift_id_route_id
    File: nbtinsert.c
    Line: 663
    Routine: _bt_check_unique
   --- End of inner exception stack trace ---
   at Npgsql.EntityFrameworkCore.PostgreSQL.Update.Internal.NpgsqlModificationCommandBatch.Consume(RelationalDataReader reader)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.&lt;&gt;c.&lt;SaveChanges&gt;b__104_0(DbContext _, ValueTuple`2 t)
   at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges()
   at Mep.Persistence.MepDbContext.SaveChanges() in /home/marcwittke/code/mep/backend/src/adapters/Mep.Persistence/MepDbContext.cs:line 129
[07:58:43 WRN] Saving changes failed due to a Postgres exception
Npgsql.PostgresException (0x80004005): 23505: duplicate key value violates unique constraint "ix_turns_language_code_shift_id_route_id"

DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.
   at Npgsql.Internal.NpgsqlConnector.&lt;ReadMessage&gt;g__ReadMessageLong|215_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
   at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
   at Npgsql.NpgsqlDataReader.NextResult()
   at Npgsql.EntityFrameworkCore.PostgreSQL.Update.Internal.NpgsqlModificationCommandBatch.Consume(RelationalDataReader reader)
  Exception data:
    Severity: ERROR
    SqlState: 23505
    MessageText: duplicate key value violates unique constraint "ix_turns_language_code_shift_id_route_id"
    Detail: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.
    SchemaName: mep
    TableName: turns
    ConstraintName: ix_turns_language_code_shift_id_route_id
    File: nbtinsert.c
    Line: 663
    Routine: _bt_check_unique</StdOut>
      </Output>
    </UnitTestResult>
  </Results>
  <TestDefinitions>
    <UnitTest name="Mep.Runtime.Tests.TheMepApplication.CanCreateProductiveTenant" storage="/home/marcwittke/code/mep/backend/tests/mep.runtime.tests/bin/debug/net6.0/mep.runtime.tests.dll" id="ef20c9ad-170e-483a-ee42-209907cd0b18">
      <Execution id="471c8012-605a-4654-8cb3-65fba9e70821" />
      <TestMethod codeBase="/home/marcwittke/code/mep/backend/tests/Mep.Runtime.Tests/bin/Debug/net6.0/Mep.Runtime.Tests.dll" adapterTypeName="executor://xunit/VsTestRunner2/netcoreapp" className="Mep.Runtime.Tests.TheMepApplication" name="CanCreateProductiveTenant" />
    </UnitTest>
    <UnitTest name="Mep.Runtime.Tests.TheMepApplication.CanCreateDemoTenant" storage="/home/marcwittke/code/mep/backend/tests/mep.runtime.tests/bin/debug/net6.0/mep.runtime.tests.dll" id="0a0bf1af-b8d3-5268-8c36-2463eacd91a2">
      <Execution id="21249158-8833-41e2-9251-f69d5e856068" />
      <TestMethod codeBase="/home/marcwittke/code/mep/backend/tests/Mep.Runtime.Tests/bin/Debug/net6.0/Mep.Runtime.Tests.dll" adapterTypeName="executor://xunit/VsTestRunner2/netcoreapp" className="Mep.Runtime.Tests.TheMepApplication" name="CanCreateDemoTenant" />
    </UnitTest>
    <UnitTest name="Mep.Runtime.Tests.TheDatabaseMigration.CanMigrateAnEmptySchema" storage="/home/marcwittke/code/mep/backend/tests/mep.runtime.tests/bin/debug/net6.0/mep.runtime.tests.dll" id="76eac0cb-41bd-4375-b9c3-3c1f9b66cd91">
      <Execution id="b182209b-7270-4bee-98fa-3d661c23ae0d" />
      <TestMethod codeBase="/home/marcwittke/code/mep/backend/tests/Mep.Runtime.Tests/bin/Debug/net6.0/Mep.Runtime.Tests.dll" adapterTypeName="executor://xunit/VsTestRunner2/netcoreapp" className="Mep.Runtime.Tests.TheDatabaseMigration" name="CanMigrateAnEmptySchema" />
    </UnitTest>
  </TestDefinitions>
  <TestEntries>
    <TestEntry testId="0a0bf1af-b8d3-5268-8c36-2463eacd91a2" executionId="21249158-8833-41e2-9251-f69d5e856068" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
    <TestEntry testId="ef20c9ad-170e-483a-ee42-209907cd0b18" executionId="471c8012-605a-4654-8cb3-65fba9e70821" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
    <TestEntry testId="76eac0cb-41bd-4375-b9c3-3c1f9b66cd91" executionId="b182209b-7270-4bee-98fa-3d661c23ae0d" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
  </TestEntries>
  <TestLists>
    <TestList name="Results Not in a List" id="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
    <TestList name="All Loaded Results" id="19431567-8539-422a-85d7-44ee4e166bda" />
  </TestLists>
  <ResultSummary outcome="Failed">
    <Counters total="3" executed="3" passed="2" failed="1" error="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" />
    <Output>
      <StdOut>[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.5.0.1+5ebf84cd75 (64-bit .NET 6.0.20)
[xUnit.net 00:00:00.08]   Discovering: Mep.Runtime.Tests
[xUnit.net 00:00:00.11]   Discovered:  Mep.Runtime.Tests
[xUnit.net 00:00:00.12]   Starting:    Mep.Runtime.Tests
[xUnit.net 00:00:30.02]       Assert.False() Failure
[xUnit.net 00:00:30.02]       Expected: False
[xUnit.net 00:00:30.02]       Actual:   True
[xUnit.net 00:00:30.02]       Stack Trace:
[xUnit.net 00:00:30.02]         /home/marcwittke/code/mep/backend/tests/Mep.Runtime.Tests/TheMepApplication.cs(69,0): at Mep.Runtime.Tests.TheMepApplication.&lt;&gt;c.&lt;CanCreateProductiveTenant&gt;b__5_1(IInstanceProvider ip)
[xUnit.net 00:00:30.02]            at Backend.Fx.Patterns.DependencyInjection.BackendFxApplicationInvoker.Invoke(Action`1 action, IIdentity identity, TenantId tenantId, Nullable`1 correlationId)
[xUnit.net 00:00:30.02]            at Backend.Fx.Patterns.DependencyInjection.ExceptionLoggingInvoker.Invoke(Action`1 action, IIdentity identity, TenantId tenantId, Nullable`1 correlationId)
[xUnit.net 00:00:30.02]         /home/marcwittke/code/mep/backend/tests/Mep.Runtime.Tests/TheMepApplication.cs(66,0): at Mep.Runtime.Tests.TheMepApplication.CanCreateProductiveTenant()
[xUnit.net 00:00:30.02]   Finished:    Mep.Runtime.Tests
</StdOut>
    </Output>
    <RunInfos>
      <RunInfo computerName="mw-ryzen5900x" outcome="Error" timestamp="2023-08-16T07:59:04.3865202-03:00">
        <Text>[xUnit.net 00:00:30.02]     Mep.Runtime.Tests.TheMepApplication.CanCreateProductiveTenant [FAIL]</Text>
      </RunInfo>
    </RunInfos>
  </ResultSummary>
</TestRun>
NasAmin commented 1 year ago

@marcwittke Thanks for reporting this. Dependabot updates to one of the packages that parses xml changed how it uses validators. This should be fixed now on the release https://github.com/NasAmin/trx-parser/releases/tag/v0.5.0. Please let me know if you still see any problems.

marcwittke commented 1 year ago

confirmed. Works as expected. Thank you!