Skip to content

Java library to enable writing to an XML file to populate an Allure report environment widget

License

Notifications You must be signed in to change notification settings

dwilliams-gs/allure-environment-xml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

allure-environment-xml

Java library to enable writing to an XML file to populate an Allure report environment widget.

  • Create a new HashMap of parameters
  • Pass that HashMap into the writeAllureEnvironmentXml which then saves those keys / values into an XML file to be consumed by the Allure report environment widget.
  • Ability to customise the Allure directory

For more information on the Allure report environment widget - https://docs.qameta.io/allure/#_environment

Example Usage

import static com.github.dwilliamsgs.utils.AllureEnvironmentUtil.*;

public class AllureEnvironmentUtilTest {

  public HashMap<String, String> parameters;

  @BeforeSuite
  void generateAllureEnvironmentXml() {
    parameters = new HashMap<>();
    parameters.put("Environment", "Production");
    parameters.put("Browser", "Chrome");
    parameters.put("Version", "98.0.4758.102");
    parameters.put("Url", "https://uk.gymshark.com/");
    parameters.put("Scope", "Smoke");
  }

  @Test
  public void hasAllureEnvironmentXmlBeenCreated() {
    writeAllureEnvironmentXml(parameters);
    assertTrue(new File(DEFAULT_ALLURE_DIRECTORY + DEFAULT_ALLURE_FILENAME).isFile());
  }

  @Test
  public void hasCustomAllureEnvironmentXmlBeenCreated() {
    String customAllureDirectory = "target/allure-results-custom/";
    writeAllureEnvironmentXml(parameters, customAllureDirectory);
    assertTrue(new File(customAllureDirectory + DEFAULT_ALLURE_FILENAME).isFile());
  }
}

Allure Report

AllureReport

Installing Package

About

Java library to enable writing to an XML file to populate an Allure report environment widget

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •  

Languages