Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added customization of source file name pattern #963

Closed
wants to merge 1 commit into from
Closed

Added customization of source file name pattern #963

wants to merge 1 commit into from

Conversation

ar4development
Copy link

Context

Currently the attachment filename pattern is hardcoded in AllureLifecycle#prepareAttachment method. Despite it if perfectly matches io.qameta.allure.AllureResultsWriter#write(java.lang.String, java.io.InputStream) specification in some cases we might need to customize the value.

For example: we have tests with numbers of steps where all those steps return same result. We do not want to keep different files for all those attachments since it overloads storage and network. So we would like to use some logic that would evaluate the attachment name depending on the content so that same content would be stored in the same file.

I understand that current implementation of io.qameta.allure.FileSystemResultsWriter does not allow to use attachment files with the same name. However I keep that out of the scope of current PR since I expect that whoever addressing the use case like mine would use their own writer which would be able to overwrite existing attachment files.

Checklist

…ed in a number of cases including optimization of number of attachment files (when they all have the same content)
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Alexey Razgulyaev seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@baev
Copy link
Member

baev commented Dec 4, 2023

The attachments API is designed not to expose file names to end users. The reason is that there are so many other features that rely on the naming convention, for example, real-time reporting & attachment filtering features from Allure TestOps.

The recommended way to optimise the storage space is to post-process the results and remove/merge/override attachments by using the LifecycleListener extensions.

Hint: override io.qameta.allure.listener.TestLifecycleListener#beforeTestWrite, then iterate over TestResult and remove all the unnecessary attachment files

@baev baev closed this Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants