首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Scalatest html报告

Scalatest html报告
EN

Stack Overflow用户
提问于 2012-11-26 20:57:40
回答 2查看 3.6K关注 0票数 3

我正在尝试获取最具伸缩性的html报告,我发现了很多这样的配置:

代码语言:javascript
复制
<plugin>                                                                                
    <groupId>org.scalatest</groupId>                                                    
    <artifactId>scalatest-maven-plugin</artifactId>                                     
    <version>1.0-M2</version>                                                           
    <configuration>                                                                     
        <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
        <testFailureIgnore>true</testFailureIgnore>                                     
        <filereports>NCXEHLOWFD file/constrained.txt,file/full.txt</filereports>        
        <xmlreports>xml</xmlreports>                                                    
        <htmlreports>html/report.html</htmlreports>                                     
    </configuration>                                                                    
    <executions>                                                                        
        <execution>                                                                     
            <id>test</id>                                                               
            <goals>                                                                     
                <goal>test</goal>                                                       
            </goals>                                                                    
        </execution>                                                                    
    </executions>                                                                       
</plugin>  

但是IntelliJ告诉我不允许使用xmlreportshtmlreports,也不会生成xml或html报告。

有没有人能提点建议?我会非常感激的

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-03-08 03:08:29

您需要使用当前可用的最新插件版本1.0-M4-SNAP1,而不是没有htmlreports属性的1.0-M2。以下是我的pom.xml中的重要部分:

代码语言:javascript
复制
<project>
    <properties>
        <scala.version>2.9.3</scala.version>
        <scalatest.version>2.0.M5b</scalatest.version>
        <scalatest.plugin.version>1.0-M4-SNAP1</scalatest.plugin.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest-maven-plugin</artifactId>
                <version>${scalatest.plugin.version}</version>
                <configuration>
                    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                    <junitxml>.</junitxml>
                    <filereports>WDF TestSuite.txt</filereports>
                    <htmlreporters>${project.build.directory}/html/scalatest</htmlreporters>
                    <testFailureIgnore>false</testFailureIgnore>
                </configuration>
                <executions>
                    <execution>
                        <id>test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
        </dependency>

        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_${scala.version}</artifactId>
            <version>${scalatest.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- required by scalatest-maven-plugin to generate HTML report -->
        <dependency>
            <groupId>org.pegdown</groupId>
            <artifactId>pegdown</artifactId>
            <version>1.2.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

有了这个设置,我可以运行mvn clean install,它将在${project.build.directory}/html/scalatest下生成漂亮的超文本标记语言报告

票数 8
EN

Stack Overflow用户

发布于 2019-05-09 19:17:38

@rozky的解决方案适用于我,但是css很笨拙。它不能正确显示表格。无论我使用什么版本的pegdown和scalatest-maven-plugin,它都不会显示表中的套件名称列:/

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13565328

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档