allure2
allure2 copied to clipboard
Title of Allure report doesn't get picked up from environment.xml
Description Based on the documentation from Allure you can specify environment values and report name in a environment file. In the docs there is a link to how document should look like: Sample
How to reproduce
Generate environment.xml file in the allure results directory.
The content can be following:
<environment> <name>Test name</name> <parameter> <key>Browser</key> <value>Chrome</value> </parameter> <parameter> <key>Browser.Version</key> <value>63.0</value> </parameter> <parameter> <key>Stand</key> <value>Production</value> </parameter> </environment>
and generate Allure report
Expected behavior Besides environment values which are correctly mapped also the report name should change from the default one to the value defined in xml document
Actual behavior Title of the allure report is still default one: Allure report
Environment:
| Test framework | [email protected] | | Allure adaptor | [email protected] | | Generate report using | [email protected]/2.13.5 |
Additional info also when testing Allure with Postman (newman) we have the same issue. I'm guessing that the problem is in allure-commandline
The content inside <name></name> tags in the environment.xml has no real use. It is just a placeholder (https://docs.qameta.io/allure/#_environment). Right now only the <key> and <value> tags are interpreted as you can see from here..
private Map<String, String> processEnvironmentXml(final Path directory) {
final Path envXmlFile = directory.resolve("environment.xml");
final Map<String, String> items = new LinkedHashMap<>();
if (Files.exists(envXmlFile)) {
try (InputStream fis = Files.newInputStream(envXmlFile)) {
xmlMapper.readValue(fis, ru.yandex.qatools.commons.model.Environment.class).getParameter().forEach(p ->
items.put(p.getKey(), p.getValue())
);
} catch (Exception e) {
LOGGER.error("Could not read environment.xml file " + envXmlFile.toAbsolutePath(), e);
}
}
return items;
}