Skip to content

Commit ea95f04

Browse files
committed
Restore functionality that made test run attachments available for all tests
1 parent d93dd4b commit ea95f04

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/Dibix.Testing/Utilities/TestRunTestResultFileComposer.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public static TestRunTestResultFileComposer Resolve(TestContext testContext, boo
3737

3838
// Use Lazy<T> to ensure the test run attachments are only written to disk once when running tests in parallel
3939
TestRunTestResultFileComposer instance = Cache.GetOrAdd(testRunIdentifier, _ => new Lazy<TestRunTestResultFileComposer>(() => Create(testContext, useDedicatedTestResultsDirectory))).Value;
40+
41+
// Make test run attachments available for each test method
42+
instance.ImportResultFilesIfNecessary(testContext);
43+
4044
return instance;
4145
}
4246

@@ -58,6 +62,15 @@ private void Initialize()
5862
EnsureEnvironmentDump();
5963
}
6064

65+
private void ImportResultFilesIfNecessary(TestContext currentTestContext)
66+
{
67+
if (currentTestContext == _testContext)
68+
return;
69+
70+
foreach (string resultFile in ResultFiles)
71+
currentTestContext.AddResultFile(resultFile);
72+
}
73+
6174
private void EnsureTestContextDump() => AddResultFile("TestContext.json", JsonConvert.SerializeObject(_testContext, new JsonSerializerSettings
6275
{
6376
Formatting = Formatting.Indented,

0 commit comments

Comments
 (0)