maven-surefire-plugin and ReportNG cannot change stylesheet for the test report

1.3k Views Asked by At

I like to change style (use another .css than reportng.css) on the standard report from ReportNG using Maven. My pom.xlm looks like this

...

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12.4</version>
                  <configuration>
                    <properties>
                        <property>
                            <name>usedefaultlisteners</name>
                            <value>false</value>
                        </property>
                        <property>
                            <name>listener</name>
                            <value>org.uncommons.reportng.HTMLReporter,org.testng.reporters.EmailableReporter</value>                             </property>

                    </properties>
                    <systemProperties>
                        <property>
                            <name>org.uncommons.reportng.title</name>
                            <value>My own titel in Test Report</value>
                        </property>
                        <property>
                            <name>org.uncommons.reportng.stylesheet</name>
                            <value>${project.basedir}/src/report/resources/MyTestReport.css</value>
                        </property>
                    </systemProperties>

...

I can change title but when I try to do the same with systemproperty org.uncommons.reportng.stylesheet I just get the default report. Have some one had the same problem and how did you solve it?

Best regards Annika

1

There are 1 best solutions below

0
On

I thought I had the same problem because I was expecting to see the CSS file I specified embedded on all pages.

Instead, it looks like ReportNG takes the styles from the css you specify (MyTestReport.css in your example above) and puts it into the generated custom.css file that is embedded on all pages.

Check **/surefire-reports/html/custom.css. Your styles should be there (assuming the path to your CSS is correct).