All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.qytera.qtaf.allure.event_subscriber.CreateAllureReportSubscriber Maven / Gradle / Ivy

There is a newer version: 0.2.23
Show newest version
package de.qytera.qtaf.allure.event_subscriber;

import de.qytera.qtaf.allure.AllureReportGenerator;
import de.qytera.qtaf.core.events.QtafEvents;
import de.qytera.qtaf.core.events.interfaces.IEventSubscriber;
import de.qytera.qtaf.core.log.model.collection.TestSuiteLogCollection;

import java.io.IOException;

/**
 * Event listener for Allure Report Plugin.
 */
public class CreateAllureReportSubscriber implements IEventSubscriber {
    @Override
    public void initialize() {
        // Subscribe to event
        QtafEvents.beforeLogsPersisted.subscribe(
                this::generateReports,
                Throwable::printStackTrace
        );
    }

    /**
     * Generate Allure JSON files.
     *
     * @param suite TestSuite
     */
    private void generateReports(TestSuiteLogCollection suite) {
        try {
            AllureReportGenerator.generateReport(suite);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy