Uploading attachments from nunit report file via CLI automation

Hi, I am trying to upload attachments included in nuint .xml report files to Testiny via CLI automation, but an struggling to get the CLI to detect them.

I’ve tried various different ways to record the attachment path and file in the nunit file, moved the location of the attachments, and also tried the --attachment-path option, but they always result in something like:

 Processing nunit file: ./reports/results_nunit.xml

  Submitted 2/2 results and 0 attachments

Here is a snippet example of a couple of attachments inside a nuint report file:

….

<attachments><attachment><filePath>.\test_output_folder\tests-login-test-py-test-login-chromium\test-finished-1.png</filePath><description>Screenshots and Videos</description></attachment><attachment><filePath>.\test_output_folder\tests-login-test-py-test-login-chromium\video.webm</filePath><description>Screenshots and Videos</description>

….

I can provide more details if needed.

edit: Folder structure

/reports/
 - nunit-report.xml
 - bunch of other report files
/reports/test-output-folder/tests-login-test-py-test-login-chromium/
	 - attachment1
	 - attachment2
	 - etc
/reports/test-output-folder/other-test2/
	 - attachment1
	 - attachment2
	 - etc
Etc

Thanks

3 Answers

3

Hi David,

Could you send us a small example (without the attachments, we only need to know the folder structure relative to the report file), to [email protected]

Thanks,
Michael

Sure, it is similar to this: /reports/ - nunit-report.xml - bunch of other report files /reports/test-output-folder/tests-login-test-py-test-login-chromium/ - attachment1 - attachment2 - etc /reports/test-output-folder/other-test2/ - attachment1 - attachment2 - etc Etc I have tried restructuring a few times, and tried a few different --attachment-path options like ./reports/test-output-folder/.

Sorry, it's not formatting very well, I'll try again

Edited original post, See above

Could you post (or send via email) the XML of the testcase(s) in question?

I've sent via email. thanks

Thanks for the test file - the NUnit importer currently has the limitation that it only imports attachments for failed tests, thats why your attachments won’t show up.

You could try and set result="Failed" in your test file to see if the paths are resolved correctly, it shoud show “Submitting attachment: ..”

I think it also makes sense to remove this NUnit-specifc limitation and always import attachments.

Thanks for the update, sadly this doesn't seem to be working for me either. I tried manually editing the file, and also forcing a test to fail. Does it work on your side?

Regarding NUnit, we have found the issue:
Some frameworks/tools seem to be generating <filePath> elements (which is the spec-correct one) and others <filepath> elements (which is incorrect but NUnit elements are almost all lowercase so..), so we will just support both variants, this should fix your issue.

Regarding JUnit, we currently only support Jenkins-style attachments:

Which tool are you using to create the JUnit file? pytest?

Regards,
Michael

Thank you - I've manually edited <filePath> to <filepath> and it is now working ok. Will you be releasing a new CLI at some point to support both? Yes I am using pytest with conftest.py fixtures that adds add_nunit_attachment or record_property to each type of report as needed. I'll look into the Jenkins style for the junit :+1:

Yes we will support both variants with the next CLI release and we will also be looking at the "property" style JUnit attachments

Perfect, many thanks for your help