Skip to content

Commit 4ac0522

Browse files
committed
feat: update version to 1.0.19, improve handling of null and empty values in test result parameters
1 parent ce59511 commit 4ac0522

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<!-- Metadata -->
33
<PropertyGroup>
4-
<Version>1.0.18</Version>
4+
<Version>1.0.19</Version>
55
<Copyright>Copyright (c) 2025 Qase</Copyright>
66
<Authors>Qase Team</Authors>
77
<Company>qase.io</Company>

Qase.XUnit.Reporter/QaseMessageSink.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ private void OnTestPassed(MessageHandlerArgs<ITestPassed> args)
6363
private void OnTestFailed(MessageHandlerArgs<ITestFailed> args)
6464
{
6565
var testResult = qaseTestData[args.Message.Test];
66-
66+
6767
// Determine if the failure is due to assertion or other reasons
6868
var isAssertionFailure = IsAssertionFailure(args.Message);
69-
69+
7070
testResult.Execution!.Status = isAssertionFailure ? TestResultStatus.Failed : TestResultStatus.Invalid;
7171
testResult.Execution!.EndTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
7272
testResult.Execution!.Duration = (int)(args.Message.ExecutionTime * 1000);
@@ -124,7 +124,18 @@ private TestResult CreateBaseTestResult(ITestCase testCase)
124124
parameter,
125125
value
126126
})
127-
.ToDictionary(x => x.parameter.Name, x => x.value?.ToString() ?? "null");
127+
.ToDictionary(x => x.parameter.Name, x =>
128+
{
129+
if (x.value is null)
130+
{
131+
return "null";
132+
}
133+
134+
if (!string.IsNullOrWhiteSpace(x.value?.ToString())) return x.value.ToString();
135+
136+
var size = x.value?.ToString().Length ?? 0;
137+
return size == 0 ? "empty" : $"empty ({size})";
138+
});
128139

129140
var result = new TestResult
130141
{
@@ -188,7 +199,7 @@ public static bool IsAssertionFailure(ITestFailed testFailed)
188199
{
189200
// Check stack trace for xUnit assertion methods
190201
var stackTrace = string.Join("\n", testFailed.StackTraces);
191-
202+
192203
// Look for xUnit assertion methods in stack trace
193204
// We need to be more specific to avoid false positives
194205
if (stackTrace.Contains("at Xunit.Assert.Equal") ||

0 commit comments

Comments
 (0)