Automating Allure Report Generation with Gauge Framework in Java Projects

63 Views Asked by At

I'm currently working on a Java project using the Gauge framework for test automation. My goal is to automate the generation of Allure reports at the end of my test executions. While Allure integrates well with many testing frameworks, I've encountered challenges integrating it seamlessly with Gauge due to the apparent lack of direct plugin support for this combination.

After running my tests with Gauge, which generates XML reports, I'm trying to automatically generate Allure reports from these XML files. I've attempted to use a ProcessBuilder in Java to execute the allure generate command post-tests, but it hasn't been successful in my setup.

Here's a snippet of my attempt:

public static void generateAllureReport() {
    ProcessBuilder processBuilder = new ProcessBuilder();
    processBuilder.command("cmd.exe", "/c", "allure generate C:/path/to/gauge/xml-reports --clean -o C:/path/to/allure-reports");
    try {
        Process process = processBuilder.start();
        int exitCode = process.waitFor();
        if (exitCode == 0) {
            System.out.println("Allure report generated successfully.");
        } else {
            System.out.println("Failed to generate Allure report.");
        }
    } catch (IOException | InterruptedException e) {
        e.printStackTrace();
    }
}

This method is supposed to be triggered automatically after all tests are completed. However, I'm facing issues with this approach, possibly due to environmental constraints or the way I'm executing the command.

Questions:

  1. Has anyone successfully automated Allure report generation in a project using Gauge as the test framework? If so, how did you configure it? Are there any recommended practices or tools that facilitate this integration without manual intervention?
  2. Could there be any environmental or security settings that might prevent the ProcessBuilder from executing the command successfully?

Any insights, suggestions, or examples of how to achieve this would be greatly appreciated. I'm looking for a solution that allows for seamless integration to enhance our project's reporting capabilities.

Thank you in advance for your help and suggestions!

NOTE:I'm aiming to achieve this without using Jenkins. My goal is for an Allure report to be automatically generated once the tests have run and completed.

0

There are 0 best solutions below