io.qameta.allure.core.AttachmentsPlugin Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of allure-generator Show documentation
Show all versions of allure-generator Show documentation
Module allure-generator of Allure Framework.
package io.qameta.allure.core;
import io.qameta.allure.Aggregator;
import io.qameta.allure.entity.Attachment;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.List;
import java.util.Map;
/**
* Plugin that stores attachments to report data folder.
*
* @since 2.0
*/
public class AttachmentsPlugin implements Aggregator {
@Override
public void aggregate(final Configuration configuration,
final List launchesResults,
final Path outputDirectory) throws IOException {
final Path attachmentsFolder = Files.createDirectories(outputDirectory.resolve("data/attachments"));
for (LaunchResults launch : launchesResults) {
for (Map.Entry entry : launch.getAttachments().entrySet()) {
final Path file = attachmentsFolder.resolve(entry.getValue().getSource());
Files.copy(entry.getKey(), file, StandardCopyOption.REPLACE_EXISTING);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy