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

de.qytera.qtaf.allure.AllureTestResultGenerator Maven / Gradle / Ivy

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

import com.google.common.net.MediaType;
import de.qytera.qtaf.core.log.model.collection.TestFeatureLogCollection;
import de.qytera.qtaf.core.log.model.collection.TestScenarioLogCollection;
import de.qytera.qtaf.core.log.model.collection.TestSuiteLogCollection;
import de.qytera.qtaf.core.log.model.message.LogMessage;
import de.qytera.qtaf.core.log.model.message.StepInformationLogMessage;
import io.qameta.allure.model.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;

/**
 * Class for mapping QTAF data structure to Allure data structure.
 */
public class AllureTestResultGenerator {
    private AllureTestResultGenerator() {
    }

    /**
     * QTAF Test Suite is mapped to list of Allure TestResult entities.
     *
     * @param collection QTAF Test suite entity
     * @return List of Allure TestResult entities
     */
    public static List fromQtafTestSuiteCollection(TestSuiteLogCollection collection) {
        List testResults = new ArrayList<>();

        // For each QTAF Test feature an Allure TestResult entity is created
        for (TestFeatureLogCollection feature : collection.getTestFeatureLogCollections()) {
            for (TestScenarioLogCollection scenario : feature.getScenarioLogCollection()) {
                testResults.add(fromQtafTestScenario(scenario));
            }
        }

        return testResults;
    }

    /**
     * Map QTAF Test feature entity to Allure TestResult entity.
     *
     * @param scenario QTAF Test Feature entity
     * @return Allure TestResult Entity
     */
    public static TestResult fromQtafTestScenario(TestScenarioLogCollection scenario) {
        List testResultSteps = AllureTestResultGenerator.getStepResultsFromQtafScenario(scenario);
        List testResultAttachments = AllureTestResultGenerator.getAllureTestResultAttachments(scenario);
        List testResultParameters = new ArrayList<>();
        List




© 2015 - 2024 Weber Informatics LLC | Privacy Policy