Allure: How do I customize the test report to write “Browsers” instead of “Xunit”?

谁都会走 提交于 2019-12-11 03:35:31

问题


In the allure test report, the overview page lists Defects, Xunit, Behaviors, and Defects. I would like to change "Xunit" to "Browsers" since my test suites are specific browsers. Is it possible to do this dynamically so it's changed for every test report generated?

Thanks


回答1:


In general changing your xUnit tab name to something else is not a good practice. For example you may want to add other suite type in the future (not corresponding to browser name).

Allure has an new cool feature to customize your report (not documented yet). To make such customization you should write your own report plugin.

First of all create a new project and add the following dependency to your pom.xml:

<dependency>
    <groupId>ru.yandex.qatools.allure</groupId>
    <artifactId>allure-report-plugin-api</artifactId>
    <version>1.4.16</version>
</dependency>

Then create a sample plugin:

@Plugin.Name("browsersXunit")
public class BrowsersXUnitPlugin extends DefaultTabPlugin {

    @Override
    public void process(AllureTestCase data) {
        //you are no need to process this data so keep it empty
    }
}

Finally add the following file to your resources:

your/plugin/package/BrowsersXUnitPlugin/script.js:

/*global angular*/
(function() {
    "use strict";
    var module = angular.module('allure.browsersXunit', []);
    module.config(function($stateProvider, allureTabsProvider) {
        //here you can perform some javascript magic 
    });
})();

It is the beta version of plugin system and some API can be changed in the future. For example take a look at the following repository.




回答2:


I would say the only way to do that is to attach a custom translation file like this one. See this commit for details.



来源:https://stackoverflow.com/questions/31730865/allure-how-do-i-customize-the-test-report-to-write-browsers-instead-of-xunit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!