Skip to content

Commit 813cd14

Browse files
authored
Merge pull request #399 from gregsdennis/trx-test-output
use trx test logger
2 parents 2e189c9 + cee0033 commit 813cd14

File tree

14 files changed

+86
-98
lines changed

14 files changed

+86
-98
lines changed

.github/workflows/dotnet-core.yml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: Build
6464
run: dotnet build --configuration Release --no-restore
6565
- name: Test
66-
run: dotnet test --no-restore --verbosity normal --logger:"junit;LogFileName=test-results.xml"
66+
run: dotnet test --no-restore --verbosity normal --logger:"trx;LogFileName=test-results.trx"
6767
- name: Upload DLLs for analysis
6868
uses: actions/upload-artifact@v2
6969
with:
@@ -74,7 +74,7 @@ jobs:
7474
uses: actions/upload-artifact@v2
7575
with:
7676
name: Unit Test Results
77-
path: '**/*/test-results.xml'
77+
path: '**/*/test-results.trx'
7878

7979
test-results:
8080
runs-on: ubuntu-latest
@@ -87,44 +87,44 @@ jobs:
8787
with:
8888
path: artifacts
8989
- name: Publish Unit Test Results
90-
uses: EnricoMi/publish-unit-test-result-action@v1
90+
uses: EnricoMi/publish-unit-test-result-action@v2
9191
if: always()
9292
with:
9393
github_token: ${{ secrets.GITHUB_TOKEN }}
94-
files: '**/*/test-results.xml'
94+
files: '**/*/test-results.trx'
9595

9696
test-badge:
97-
needs: build
9897
runs-on: ubuntu-latest
98+
needs: build
99+
if: success() || failure()
99100
steps:
100-
- name: Extract Branch Name
101-
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
102-
- name: Download Artifacts
103-
uses: actions/download-artifact@v2
104-
with:
105-
path: artifacts
106-
- name: Get badge details
107-
run: |
108-
find . -name test-results.xml -exec cat '{}' >> all-results.xml \;
109-
TEST_COUNT=`grep -Pio '(?<=tests=")\d+' all-results.xml | awk '{ SUM += $1} END { print SUM }'`
110-
echo "FAIL_COUNT=`grep -Pio '(?<=failures=")\d+' all-results.xml | awk '{ SUM += $1} END { print SUM }'`" >> $GITHUB_ENV
111-
echo "PASS_COUNT=$((TEST_COUNT - FAIL_COUNT))" >> $GITHUB_ENV
112-
if [[ $FAIL_COUNT -eq 0 ]]
113-
then
114-
echo "BUILD_STATUS=success" >> $GITHUB_ENV
115-
else
116-
echo "BUILD_STATUS=critical" >> $GITHUB_ENV
117-
fi
118-
- name: Create test results badge
119-
if: env.BRANCH == 'master'
120-
uses: schneegans/[email protected]
121-
with:
122-
auth: ${{ secrets.TEST_BADGE_KEY }}
123-
gistID: 28607f2d276032f4d9a7f2c807e44df7
124-
filename: test-results-badge.json
125-
label: tests
126-
message: ${{ format('{0} passing | {1} failing', env.PASS_COUNT, env.FAIL_COUNT) }}
127-
color: ${{ env.BUILD_STATUS }}
101+
- name: Extract Branch Name
102+
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
103+
- name: Download Artifacts
104+
uses: actions/download-artifact@v2
105+
with:
106+
path: artifacts
107+
- name: Get badge details
108+
run: |
109+
find . -name test-results.trx -exec cat '{}' >> all-results.xml \;
110+
echo "FAIL_COUNT=`grep -Pio '(?<=failed=")\d+' all-results.xml | awk '{ SUM += $1} END { print SUM }'`" >> $GITHUB_ENV
111+
echo "PASS_COUNT=`grep -Pio '(?<=passed=")\d+' all-results.xml | awk '{ SUM += $1} END { print SUM }'`" >> $GITHUB_ENV
112+
if [[ $FAIL_COUNT -eq 0 ]]
113+
then
114+
echo "BUILD_STATUS=success" >> $GITHUB_ENV
115+
else
116+
echo "BUILD_STATUS=critical" >> $GITHUB_ENV
117+
fi
118+
- name: Create test results badge
119+
if: env.BRANCH == 'master'
120+
uses: schneegans/[email protected]
121+
with:
122+
auth: ${{ secrets.TEST_BADGE_KEY }}
123+
gistID: 28607f2d276032f4d9a7f2c807e44df7
124+
filename: test-results-badge.json
125+
label: tests
126+
message: ${{ format('{0} passing | {1} failing', env.PASS_COUNT, env.FAIL_COUNT) }}
127+
color: ${{ env.BUILD_STATUS }}
128128

129129
analyze-more:
130130
if: github.event_name == 'pull_request'

Json.More.Tests/Json.More.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="JetBrains.Annotations" Version="2021.2.0" />
16-
<PackageReference Include="JunitXml.TestLogger" Version="3.0.124" />
1716
<PackageReference Include="NUnit" Version="3.13.3" />
1817
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
1918
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />

JsonLogic.Tests/JsonLogic.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="JunitXml.TestLogger" Version="3.0.124" />
1716
<PackageReference Include="NUnit" Version="3.13.3" />
1817
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
1918
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />

JsonPatch.Tests/GithubTests.cs

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,29 @@ public void Issue393_PatchDoesNothing()
2626
Console.WriteLine(JsonSerializer.Serialize(patchConfig));
2727

2828
const string singleObjectJson = "{" +
29-
"\"_id\":\"640729d45434f90313d25c78\"," +
30-
"\"guid\":\"f2e2767c-03e0-4862-addc-7d46c55efb33\"," +
31-
"\"first_name\":\"Kathrine\"," +
32-
"\"last_name\":\"Pate\"" +
33-
"}";
29+
"\"_id\":\"640729d45434f90313d25c78\"," +
30+
"\"guid\":\"f2e2767c-03e0-4862-addc-7d46c55efb33\"," +
31+
"\"first_name\":\"Kathrine\"," +
32+
"\"last_name\":\"Pate\"" +
33+
"}";
3434

3535
var singleObject = JsonDocument.Parse(singleObjectJson).RootElement;
3636
var patchedSingleObject = patchConfig.Apply(singleObject.AsNode()).Result;
3737
Console.WriteLine(JsonSerializer.Serialize(patchedSingleObject));
3838

3939
const string arrayObjectJson = "[" +
40-
"{" +
41-
"\"_id\":\"640729d45434f90313d25c78\"," +
42-
"\"guid\":\"f2e2767c-03e0-4862-addc-7d46c55efb33\"," +
43-
"\"first_name\":\"Kathrine\"," +
44-
"\"last_name\":\"Pate\"" +
45-
"}," +
46-
"{\"_id\":\"640729d45b5824ffcabc30a5\"," +
47-
"\"guid\":\"73193eda-074b-4f31-9f09-507a008ccb75\"," +
48-
"\"first_name\":\"Rivers\"," +
49-
"\"last_name\":\"Smith\"" +
50-
"}" +
51-
"]";
40+
"{" +
41+
"\"_id\":\"640729d45434f90313d25c78\"," +
42+
"\"guid\":\"f2e2767c-03e0-4862-addc-7d46c55efb33\"," +
43+
"\"first_name\":\"Kathrine\"," +
44+
"\"last_name\":\"Pate\"" +
45+
"}," +
46+
"{\"_id\":\"640729d45b5824ffcabc30a5\"," +
47+
"\"guid\":\"73193eda-074b-4f31-9f09-507a008ccb75\"," +
48+
"\"first_name\":\"Rivers\"," +
49+
"\"last_name\":\"Smith\"" +
50+
"}" +
51+
"]";
5252

5353
var arrayObject = JsonDocument.Parse(arrayObjectJson).RootElement;
5454

@@ -69,33 +69,33 @@ public void Issue393_NodeAlreadyHasParent_2()
6969
var patchConfig = new JsonPatch(patchOperations);
7070

7171
const string singleObjectJson = "{" +
72-
"\"_id\":\"640729d45434f90313d25c78\"," +
73-
"\"guid\":\"f2e2767c-03e0-4862-addc-7d46c55efb33\"," +
74-
"\"first_name\":\"Kathrine\"," +
75-
"\"last_name\":\"Pate\"" +
76-
"}";
72+
"\"_id\":\"640729d45434f90313d25c78\"," +
73+
"\"guid\":\"f2e2767c-03e0-4862-addc-7d46c55efb33\"," +
74+
"\"first_name\":\"Kathrine\"," +
75+
"\"last_name\":\"Pate\"" +
76+
"}";
7777

7878
var singleObject = JsonDocument.Parse(singleObjectJson).RootElement;
7979
var patchedSingleObject = patchConfig.Apply(singleObject.AsNode()).Result;
8080
Console.WriteLine(JsonSerializer.Serialize(patchedSingleObject));
8181

8282
const string arrayObjectJson = "[" +
83-
"{" +
84-
"\"_id\":\"640729d45434f90313d25c78\"," +
85-
"\"guid\":\"f2e2767c-03e0-4862-addc-7d46c55efb33\"," +
86-
"\"first_name\":\"Kathrine\"," +
87-
"\"last_name\":\"Pate\"" +
88-
"}," +
89-
"{\"_id\":\"640729d45b5824ffcabc30a5\"," +
90-
"\"guid\":\"73193eda-074b-4f31-9f09-507a008ccb75\"," +
91-
"\"first_name\":\"Rivers\"," +
92-
"\"last_name\":\"Smith\"" +
93-
"}" +
94-
"]";
83+
"{" +
84+
"\"_id\":\"640729d45434f90313d25c78\"," +
85+
"\"guid\":\"f2e2767c-03e0-4862-addc-7d46c55efb33\"," +
86+
"\"first_name\":\"Kathrine\"," +
87+
"\"last_name\":\"Pate\"" +
88+
"}," +
89+
"{\"_id\":\"640729d45b5824ffcabc30a5\"," +
90+
"\"guid\":\"73193eda-074b-4f31-9f09-507a008ccb75\"," +
91+
"\"first_name\":\"Rivers\"," +
92+
"\"last_name\":\"Smith\"" +
93+
"}" +
94+
"]";
9595

9696
var arrayObject = JsonDocument.Parse(arrayObjectJson).RootElement;
9797

98-
var jsonArray = arrayObject.AsNode().AsArray();
98+
var jsonArray = arrayObject.AsNode()!.AsArray();
9999

100100
// Way 2: just patch every element
101101
foreach (var element in jsonArray)
@@ -116,33 +116,33 @@ public void Issue393_NodeAlreadyHasParent_3()
116116
var patchConfig = new JsonPatch(patchOperations);
117117

118118
const string singleObjectJson = "{" +
119-
"\"_id\":\"640729d45434f90313d25c78\"," +
120-
"\"guid\":\"f2e2767c-03e0-4862-addc-7d46c55efb33\"," +
121-
"\"first_name\":\"Kathrine\"," +
122-
"\"last_name\":\"Pate\"" +
123-
"}";
119+
"\"_id\":\"640729d45434f90313d25c78\"," +
120+
"\"guid\":\"f2e2767c-03e0-4862-addc-7d46c55efb33\"," +
121+
"\"first_name\":\"Kathrine\"," +
122+
"\"last_name\":\"Pate\"" +
123+
"}";
124124

125125
var singleObject = JsonNode.Parse(singleObjectJson);
126126
var patchedSingleObject = patchConfig.Apply(singleObject).Result;
127127
Console.WriteLine(JsonSerializer.Serialize(patchedSingleObject));
128128

129129
const string arrayObjectJson = "[" +
130-
"{" +
131-
"\"_id\":\"640729d45434f90313d25c78\"," +
132-
"\"guid\":\"f2e2767c-03e0-4862-addc-7d46c55efb33\"," +
133-
"\"first_name\":\"Kathrine\"," +
134-
"\"last_name\":\"Pate\"" +
135-
"}," +
136-
"{\"_id\":\"640729d45b5824ffcabc30a5\"," +
137-
"\"guid\":\"73193eda-074b-4f31-9f09-507a008ccb75\"," +
138-
"\"first_name\":\"Rivers\"," +
139-
"\"last_name\":\"Smith\"" +
140-
"}" +
141-
"]";
130+
"{" +
131+
"\"_id\":\"640729d45434f90313d25c78\"," +
132+
"\"guid\":\"f2e2767c-03e0-4862-addc-7d46c55efb33\"," +
133+
"\"first_name\":\"Kathrine\"," +
134+
"\"last_name\":\"Pate\"" +
135+
"}," +
136+
"{\"_id\":\"640729d45b5824ffcabc30a5\"," +
137+
"\"guid\":\"73193eda-074b-4f31-9f09-507a008ccb75\"," +
138+
"\"first_name\":\"Rivers\"," +
139+
"\"last_name\":\"Smith\"" +
140+
"}" +
141+
"]";
142142

143143
var arrayObject = JsonNode.Parse(arrayObjectJson);
144144

145-
var jsonArray = arrayObject.AsArray();
145+
var jsonArray = arrayObject!.AsArray();
146146

147147
// Way 3: remove from initial array and then patch
148148
for (int currentIndex = jsonArray.Count - 1; currentIndex >= 0; currentIndex--)

JsonPatch.Tests/JsonPatch.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="JunitXml.TestLogger" Version="3.0.124" />
1716
<PackageReference Include="nunit" Version="3.13.3" />
1817
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
1918
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />

JsonPath.Tests/JsonPath.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
<ItemGroup>
1616
<PackageReference Include="FluentAssertions" Version="6.10.0" />
17-
<PackageReference Include="JunitXml.TestLogger" Version="3.0.124" />
1817
<PackageReference Include="nunit" Version="3.13.3" />
1918
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
2019
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />

JsonPointer.Tests/JsonPointer.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="FluentAssertions" Version="6.10.0" />
15-
<PackageReference Include="JunitXml.TestLogger" Version="3.0.124" />
1615
<PackageReference Include="nunit" Version="3.13.3" />
1716
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
1817
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />

JsonSchema.Data.Tests/JsonSchema.Data.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="JunitXml.TestLogger" Version="3.0.124" />
1514
<PackageReference Include="NUnit" Version="3.13.3" />
1615
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
1716
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />

JsonSchema.DataGeneration.Tests/JsonSchema.DataGeneration.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="JunitXml.TestLogger" Version="3.0.124" />
1716
<PackageReference Include="FluentAssertions" Version="6.10.0" />
1817
<PackageReference Include="NUnit" Version="3.13.3" />
1918
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />

JsonSchema.Generation.Tests/JsonSchema.Generation.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="JunitXml.TestLogger" Version="3.0.124" />
1716
<PackageReference Include="NUnit" Version="3.13.3" />
1817
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
1918
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />

0 commit comments

Comments
 (0)