Skip to content

Commit 1415dc7

Browse files
committed
Fixed a bug with method arguments in test names
1 parent 5f5032f commit 1415dc7

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

ReleaseNotes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 0.4.1
22

33
- [Fix] Fixed a bug with source parsing and file paths
4+
- [Fix] Fixed a bug with method arguments in test names
45

56
# 0.4.0
67

src/AzurePipelines.TestLogger/LoggerQueue.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,13 @@ internal IEnumerable<IGrouping<string, ITestResult>> GroupTestResultsByParent(IT
156156
}
157157

158158
// At this point, name should always have at least one '.' to represent the Class.Method
159-
return name.Substring(0, name.LastIndexOfAny(new[] { '.' }));
159+
// We need to start at the opening method paren if there is one
160+
int startIndex = name.IndexOf('(');
161+
if(startIndex < 0)
162+
{
163+
startIndex = name.Length - 1;
164+
}
165+
return name.Substring(0, name.LastIndexOfAny(new[] { '.' }, startIndex));
160166
});
161167

162168
// Internal for testing

tests/AzurePipelines.TestLogger.Tests/LoggerQueueTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void GroupTestResults()
136136
},
137137
new TestTestResult
138138
{
139-
FullyQualifiedName = "Fizz.Buzz.FutzFixture.BooMethod(\"x\")"
139+
FullyQualifiedName = "Fizz.Buzz.FutzFixture.BooMethod(\"x.y\")"
140140
},
141141
new TestTestResult
142142
{
@@ -190,7 +190,7 @@ public void CreateParents()
190190
},
191191
new TestTestResult
192192
{
193-
FullyQualifiedName = "Fizz.Buzz.FutzFixture.NestedFixture.BooMethod(\"x\")"
193+
FullyQualifiedName = "Fizz.Buzz.FutzFixture.NestedFixture.BooMethod(\"x.y\")"
194194
}
195195
};
196196
IEnumerable<IGrouping<string, ITestResult>> testResultsByParent = loggerQueue.GroupTestResultsByParent(testResults);

0 commit comments

Comments
 (0)