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

ru.yandex.qatools.allure.data.providers.GraphDataProvider Maven / Gradle / Ivy

There is a newer version: 1.5.4
Show newest version
package ru.yandex.qatools.allure.data.providers;

import ru.yandex.qatools.allure.data.AllureGraph;

import javax.xml.bind.JAXB;
import java.io.File;
import java.io.StringReader;

import static ru.yandex.qatools.allure.data.utils.AllureReportUtils.serialize;
import static ru.yandex.qatools.allure.data.utils.XslTransformationUtils.applyTransformation;

/**
 * @author Dmitry Baev [email protected]
 *         Date: 06.12.13
 */
public class GraphDataProvider implements DataProvider {

    private static final String TEST_RUN_TO_GRAPH_XSL = "xsl/testrun-to-graph.xsl";

    private static final String GRAPH_JSON = "graph.json";

    @Override
    public void provide(String testPack, File outputDirectory) {
        String allureGraphBody = applyTransformation(testPack, TEST_RUN_TO_GRAPH_XSL);

        AllureGraph allureGraph = JAXB.unmarshal(
                new StringReader(allureGraphBody),
                AllureGraph.class
        );

        serialize(outputDirectory, GRAPH_JSON, allureGraph);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy