Skip to content

Commit 1aee79f

Browse files
committed
Added processingSettings
1 parent 1267291 commit 1aee79f

6 files changed

Lines changed: 28 additions & 25 deletions

File tree

src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ public interface IVsTestConsoleWrapperAsync
9696
/// Provides back all attachments to TestPlatform for additional processing (for example merging)
9797
/// </summary>
9898
/// <param name="attachments">Collection of attachments</param>
99-
/// <param name="multiTestRunCompleted">Indicates that all test executions are done and all data is provided</param>
99+
/// <param name="processingSettings">XML processing settings</param>
100+
/// <param name="isLastBatch">Indicates that all test executions are done and all data is provided</param>
100101
/// <param name="collectMetrics">Enables metrics collection (used for telemetry)</param>
101102
/// <param name="eventsHandler">EventHandler to receive session complete event</param>
102103
/// <param name="cancellationToken">Cancellation token</param>
103-
Task ProcessTestRunAttachmentsAsync(IEnumerable<AttachmentSet> attachments, bool multiTestRunCompleted, bool collectMetrics, ITestRunAttachmentsProcessingEventsHandler eventsHandler, CancellationToken cancellationToken);
104+
Task ProcessTestRunAttachmentsAsync(IEnumerable<AttachmentSet> attachments, string processingSettings, bool isLastBatch, bool collectMetrics, ITestRunAttachmentsProcessingEventsHandler eventsHandler, CancellationToken cancellationToken);
104105

105106
/// <summary>
106107
/// See <see cref="IVsTestConsoleWrapper.EndSession"/>.

src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public void EndSession()
276276

277277
#endregion
278278

279-
#region IVsTestConsoleWrapper
279+
#region IVsTestConsoleWrapperAsync
280280

281281
/// <inheritdoc/>
282282
public async Task StartSessionAsync()
@@ -407,7 +407,7 @@ public async Task RunTestsWithCustomTestHostAsync(IEnumerable<TestCase> testCase
407407
}
408408

409409
/// <inheritdoc/>
410-
public async Task ProcessTestRunAttachmentsAsync(IEnumerable<AttachmentSet> attachments, bool multiTestRunCompleted, bool collectMetrics, ITestRunAttachmentsProcessingEventsHandler testSessionEventsHandler, CancellationToken cancellationToken)
410+
public async Task ProcessTestRunAttachmentsAsync(IEnumerable<AttachmentSet> attachments, string processingSettings, bool isLastBatch, bool collectMetrics, ITestRunAttachmentsProcessingEventsHandler testSessionEventsHandler, CancellationToken cancellationToken)
411411
{
412412
this.testPlatformEventSource.TranslationLayerTestRunAttachmentsProcessingStart();
413413

test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CodeCoverageTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public async Task TestRunWithCodeCoverageAndAttachmentsProcessing(RunnerInfo run
104104
Assert.AreEqual(2, this.runEventHandler.Attachments.Count);
105105

106106
// act
107-
await this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(runEventHandler.Attachments, true, true, testRunAttachmentsProcessingEventHandler, CancellationToken.None);
107+
await this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(runEventHandler.Attachments, null, true, true, testRunAttachmentsProcessingEventHandler, CancellationToken.None);
108108

109109
// Assert
110110
testRunAttachmentsProcessingEventHandler.EnsureSuccess();
@@ -153,7 +153,7 @@ public async Task TestRunWithCodeCoverageAndAttachmentsProcessingNoMetrics(Runne
153153
Assert.AreEqual(2, this.runEventHandler.Attachments.Count);
154154

155155
// act
156-
await this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(runEventHandler.Attachments, true, false, testRunAttachmentsProcessingEventHandler, CancellationToken.None);
156+
await this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(runEventHandler.Attachments, null, true, false, testRunAttachmentsProcessingEventHandler, CancellationToken.None);
157157

158158
// Assert
159159
testRunAttachmentsProcessingEventHandler.EnsureSuccess();
@@ -200,7 +200,7 @@ public async Task TestRunWithCodeCoverageAndAttachmentsProcessingModuleDuplicate
200200
Assert.AreEqual(3, this.runEventHandler.Attachments.Count);
201201

202202
// act
203-
await this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(runEventHandler.Attachments, true, true, testRunAttachmentsProcessingEventHandler, CancellationToken.None);
203+
await this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(runEventHandler.Attachments, null, true, true, testRunAttachmentsProcessingEventHandler, CancellationToken.None);
204204

205205
// Assert
206206
testRunAttachmentsProcessingEventHandler.EnsureSuccess();
@@ -252,7 +252,7 @@ public async Task TestRunWithCodeCoverageAndAttachmentsProcessingCancelled(Runne
252252

253253
CancellationTokenSource cts = new CancellationTokenSource();
254254

255-
Task attachmentsProcessing = this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(attachments, true, true, testRunAttachmentsProcessingEventHandler, cts.Token);
255+
Task attachmentsProcessing = this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(attachments, null, true, true, testRunAttachmentsProcessingEventHandler, cts.Token);
256256

257257
while (true)
258258
{
@@ -318,7 +318,7 @@ public async Task EndSessionShouldEnsureVstestConsoleProcessDies(RunnerInfo runn
318318
Assert.AreEqual(6, this.runEventHandler.TestResults.Count);
319319
Assert.AreEqual(2, this.runEventHandler.Attachments.Count);
320320

321-
await this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(runEventHandler.Attachments, true, true, testRunAttachmentsProcessingEventHandler, CancellationToken.None);
321+
await this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(runEventHandler.Attachments, null, true, true, testRunAttachmentsProcessingEventHandler, CancellationToken.None);
322322

323323
// act
324324
this.vstestConsoleWrapper?.EndSession();

test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/AttachmentsProcessing/TestRunAttachmentsProcessingManagerTests.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsT
7474
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
7575
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
7676

77-
VerifyMetrics(0, 0);
77+
VerifyMetrics(inputCount: 0, outputCount: 0);
7878
}
7979

8080
[TestMethod]
@@ -93,7 +93,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnNoAttachments_IfNoA
9393
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
9494
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
9595

96-
VerifyMetrics(0, 0);
96+
VerifyMetrics(inputCount: 0, outputCount: 0);
9797
}
9898

9999
[TestMethod]
@@ -117,7 +117,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1NotProcessedAttach
117117
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
118118
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
119119

120-
VerifyMetrics(1, 1);
120+
VerifyMetrics(inputCount: 1, outputCount: 1);
121121
}
122122

123123
[TestMethod]
@@ -140,7 +140,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1NotProcessedAttach
140140
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
141141
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
142142

143-
VerifyMetrics(1, 1);
143+
VerifyMetrics(inputCount: 1, outputCount: 1);
144144
}
145145

146146
[TestMethod]
@@ -171,7 +171,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1ProcessedAttachmen
171171
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.Is<ICollection<AttachmentSet>>(c => c.Count == 1 && c.Contains(inputAttachments[0])), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), cancellationTokenSource.Token));
172172
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
173173

174-
VerifyMetrics(1, 1);
174+
VerifyMetrics(inputCount: 1, outputCount: 1);
175175
}
176176

177177
[TestMethod]
@@ -203,7 +203,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1ProcessedAttachmen
203203
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.Is<ICollection<AttachmentSet>>(c => c.Count == 1 && c.Contains(inputAttachments[0])), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), cancellationTokenSource.Token));
204204
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
205205

206-
VerifyMetrics(1, 1);
206+
VerifyMetrics(inputCount: 1, outputCount: 1);
207207
}
208208

209209
[TestMethod]
@@ -229,7 +229,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsT
229229
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.Is<ICollection<AttachmentSet>>(c => c.Count == 1 && c.Contains(inputAttachments[0])), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), cancellationTokenSource.Token));
230230
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
231231

232-
VerifyMetrics(1, 1, "Failed");
232+
VerifyMetrics(inputCount: 1, outputCount: 1, status: "Failed");
233233
}
234234

235235
[TestMethod]
@@ -254,7 +254,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachments_
254254
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.Is<ICollection<AttachmentSet>>(c => c.Count == 1 && c.Contains(inputAttachments[0])), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), cancellationTokenSource.Token));
255255
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
256256

257-
VerifyMetrics(1, 1, "Failed");
257+
VerifyMetrics(inputCount: 1, outputCount: 1, status: "Failed");
258258
}
259259

260260
[TestMethod]
@@ -277,8 +277,8 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsT
277277
mockAttachmentHandler2.Verify(h => h.GetExtensionUris(), Times.Never);
278278
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
279279
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
280-
281-
VerifyMetrics(1, 1, "Canceled");
280+
281+
VerifyMetrics(inputCount: 1, outputCount: 1, status: "Canceled");
282282
}
283283

284284
[TestMethod]
@@ -302,7 +302,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachments_
302302
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
303303
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
304304

305-
VerifyMetrics(1, 1, "Canceled");
305+
VerifyMetrics(inputCount: 1, outputCount: 1, status: "Canceled");
306306
}
307307

308308
[TestMethod]
@@ -343,7 +343,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnProcessedAttachment
343343
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.Is<ICollection<AttachmentSet>>(c => c.Count == 2 && c.Contains(inputAttachments[0]) && c.Contains(inputAttachments[1])), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), cancellationTokenSource.Token));
344344
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.Is<ICollection<AttachmentSet>>(c => c.Count == 2 && c.Contains(inputAttachments[2]) && c.Contains(inputAttachments[3])), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), cancellationTokenSource.Token));
345345

346-
VerifyMetrics(5, 3);
346+
VerifyMetrics(inputCount: 5, outputCount: 3);
347347
}
348348

349349
[TestMethod]
@@ -385,7 +385,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnProcessedAttachment
385385
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.Is<ICollection<AttachmentSet>>(c => c.Count == 2 && c.Contains(inputAttachments[0]) && c.Contains(inputAttachments[1])), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), cancellationTokenSource.Token));
386386
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.Is<ICollection<AttachmentSet>>(c => c.Count == 2 && c.Contains(inputAttachments[2]) && c.Contains(inputAttachments[3])), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), cancellationTokenSource.Token));
387387

388-
VerifyMetrics(5, 3);
388+
VerifyMetrics(inputCount: 5, outputCount: 3);
389389
}
390390

391391
[TestMethod]
@@ -450,7 +450,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsT
450450
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.Is<ICollection<AttachmentSet>>(c => c.Count == 1 && c.Contains(inputAttachments[0])), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), cancellationTokenSource.Token));
451451
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
452452

453-
VerifyMetrics(1, 1, "Canceled");
453+
VerifyMetrics(inputCount: 1, outputCount: 1, status: "Canceled");
454454
}
455455

456456
[TestMethod]
@@ -510,7 +510,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachments_
510510
mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.Is<ICollection<AttachmentSet>>(c => c.Count == 1 && c.Contains(inputAttachments[0])), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), cancellationTokenSource.Token));
511511
mockAttachmentHandler2.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>()), Times.Never);
512512

513-
VerifyMetrics(1, 1, "Canceled");
513+
VerifyMetrics(inputCount: 1, outputCount: 1, status: "Canceled");
514514
}
515515

516516
[TestMethod]
@@ -584,7 +584,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnProperlySendProgres
584584
mockEventsHandler.Verify(h => h.HandleLogMessage(TestMessageLevel.Informational, "info"));
585585
mockEventsHandler.Verify(h => h.HandleLogMessage(TestMessageLevel.Error, "error"));
586586

587-
VerifyMetrics(2, 2, "Completed");
587+
VerifyMetrics(inputCount: 2, outputCount: 2);
588588
}
589589

590590
private void VerifyMetrics(int inputCount, int outputCount, string status = "Completed")

test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ public async Task ProcessTestRunAttachmentsAsyncShouldSucceed()
317317

318318
await this.consoleWrapper.ProcessTestRunAttachmentsAsync(
319319
attachments,
320+
null,
320321
true,
321322
true,
322323
new Mock<ITestRunAttachmentsProcessingEventsHandler>().Object,

test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ public async Task ProcessTestRunAttachmentsAsyncShouldSucceed()
315315

316316
await this.consoleWrapper.ProcessTestRunAttachmentsAsync(
317317
attachments,
318+
null,
318319
true,
319320
true,
320321
new Mock<ITestRunAttachmentsProcessingEventsHandler>().Object,

0 commit comments

Comments
 (0)