Skip to content

Attachments with same filename but different file path within the same test case are being considered duplicates #165

Description

@MJB222398

Jenkins and plugins versions report

Jenkins 2.492.1

What Operating System are you using (both controller, and any agents involved in the problem)?

Ubuntu

Reproduction steps

Process this following test results file:

<testsuites>
	<testsuite name="MyTestAssembly.dll" tests="3" skipped="0" failures="0" errors="0" time="0.0039629999999999995" timestamp="2025-03-11T15:09:45" hostname="jenkins-worker5" id="0" package="MyTestAssembly.dll">
		<properties/>
		<testcase classname="MyTestAssembly.Tests.JUnit.JunitPluginTests" name="TestCase1" time="0.0033490">
			<system-out><![CDATA[I am TestCase1

[[ATTACHMENT|C:\Users\MyUser\source\repos\forks\junit-attachments-plugin\work\workspace\ann-build-old\TestCase1\Attachment.txt]]
[[ATTACHMENT|C:\Users\MyUser\source\repos\forks\junit-attachments-plugin\work\workspace\ann-build-old\TestCase1\Nested\Attachment.txt]]
]]></system-out>
		</testcase>
		<testcase classname="MyTestAssembly.Tests.JUnit.JunitPluginTests" name="TestCase2" time="0.0004200">
			<system-out><![CDATA[I am TestCase2

[[ATTACHMENT|C:\Users\MyUser\source\repos\forks\junit-attachments-plugin\work\workspace\ann-build-old\TestCase2\Attachment.txt]]
]]></system-out>
		</testcase>
		<testcase classname="MyTestAssembly.Tests.JUnit.JunitPluginTests" name="TestCase3" time="0.0001940">
			<system-out><![CDATA[I am TestCase3

[[ATTACHMENT|C:\Users\MyUser\source\repos\forks\junit-attachments-plugin\work\workspace\ann-build-old\TestCase3\Attachment.txt]]
]]></system-out>
		</testcase>
		<system-out/>
		<system-err/>
	</testsuite>
</testsuites>

Note that for TestCase1 the attachment under the \Nested directory is not included in the results because it has the same filename as the other attachment for this test case.

Expected Results

Both files should be kept and processed. Perhaps we need to set the attachment 'name/key' as the path relative to the lowest level common sub-directory of the attachments so we can maintain this filesystem structure for the attachments?

Actual Results

Only one attachment is kept and displayed

Anything else?

No response

Are you interested in contributing a fix?

Yes, if I have the time

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions