vedro-universe / vedro

Pragmatic Testing Framework
https://vedro.io
Apache License 2.0
33 stars 8 forks source link

[Feature]: Add support for `on_save` hook in ArtifactedPlugin #102

Open tsv1 opened 2 weeks ago

tsv1 commented 2 weeks ago

Summary:

Currently, the ArtifactedPlugin saves all artifacts by default without providing fine-grained control over which artifacts are saved and how they are processed. This feature request proposes adding an on_save hook that gives users flexibility in deciding which artifacts to save, how to save them, and handling special use cases such as encryption or grouping artifacts.

The on_save hook would allow users to:

  1. Selectively choose which artifacts to save based on their type or content.
  2. Customize the saving process, such as packaging artifacts into a .zip file or encrypting sensitive information before saving.

Use Cases:

  1. Selective Saving of Artifacts: Users may generate different types of artifacts during tests (e.g., logs, screenshots, reports). With the on_save hook, users can implement logic to save only specific artifact types, reducing unnecessary storage usage and clutter. For example, saving only image files or logs while discarding others.

  2. Custom Grouping or Packaging of Artifacts: For tests generating multiple artifacts, saving them individually may be inefficient or cluttered. The on_save hook can be used to group artifacts (e.g., into a single .zip file) and save them more efficiently, making it easier to share or upload test results.

  3. Handling Sensitive Data: Artifacts may contain sensitive information (e.g., personal data, passwords, or confidential logs). The on_save hook can help users implement custom encryption or security measures to protect this data before saving it to disk.

tsv1 commented 2 weeks ago

One additional point for consideration: we should evaluate whether this functionality is best implemented as a hook or using a strategy pattern.