allure-framework / allure2

Allure Report is a flexible, lightweight multi-language test reporting tool. It provides clear graphical reports and allows everyone involved in the development process to extract the maximum of information from the everyday testing process
https://allurereport.org/
Apache License 2.0
4.18k stars 708 forks source link

Title of Allure report doesn't get picked up from environment.xml #1134

Closed premuss closed 9 months ago

premuss commented 4 years ago

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: `

Test 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>

` 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 | jasmine@3.6.1 | | Allure adaptor | jasmine-allure2-reporter@1.2.0 | | Generate report using | allure-commandline@2.13.0/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

kartnan commented 3 years ago

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;
    }