Pom.xml无法为reportng结果创建输出目录

时间:2013-09-30 10:14:13

标签: xslt webdriver maven-3 testng reportng

我浏览过很多帖子和博客,但无法通过maven生成reportngtestng-xslt报告。最后我得到了this教程,但没有运气。我不明白我错过了什么。
以下是我尝试过的内容:它在目标文件夹中成功生成了surefire报告,但没有为reportng报告创建(生成报告)目录。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.testng.xslt</groupId>
    <artifactId>testng-xslt-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <name>TestNG XSLT Maven Plugin</name>
    <version>1.2</version>

    <prerequisites>
        <maven>2.0.4</maven>
    </prerequisites>

    <developers>
        <developer>
            <id>cosminaru</id>
            <name>Cosmin Marginean</name>
            <email>cosminaru@gmail.com</email>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.14.1</version>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>C:/Users/paul/Desktop/reporty-ng-1.2/testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.reportyng</groupId>
                <artifactId>reporty-ng</artifactId>
                <version>1.2</version>
                <configuration>
                    <surefireReportDirectory>C:/Users/paul/Desktop/reporty-ng-1.2/target/surefire-reports</surefireReportDirectory>
                    <!--Setting the output directory -->
                    <outputDir>C:/Users/paul/workspace/windowspc/target/site/testng-xslt-plugin</outputDir>
                    <!--Setting the testNgXslt.showRuntimeTotals flag -->
                    <showRuntimeTotals>true</showRuntimeTotals>
                    <!--Setting the testNgXslt.cssFile parameter. This should be relative 
                        to the '${basedir}/target/site/testng-xslt' directory -->
                    <sortTestCaseLinks>true</sortTestCaseLinks>
                    <testDetailsFilter>FAIL,PASS,SKIP,CONF</testDetailsFilter>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

    <dependencies>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>2.0.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.reporting</groupId>
            <artifactId>maven-reporting-api</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.reporting</groupId>
            <artifactId>maven-reporting-impl</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>net.sf.saxon</groupId>
            <artifactId>saxon</artifactId>
            <version>8.7</version>
        </dependency>

        <!-- selenium and testng -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>2.34.0</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.34.0</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-support</artifactId>
            <version>2.34.0</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-api</artifactId>
            <version>2.34.0</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.3.1</version>
            <scope>test</scope>
        </dependency>
        <!-- selenium and testng -->

    </dependencies>
    <pluginRepositories>
        <pluginRepository>
            <id>reporty-ng</id>
            <url>https://github.com/cosminaru/reporty-ng/raw/master/dist/maven</url>
        </pluginRepository>
    </pluginRepositories>

</project>

1 个答案:

答案 0 :(得分:0)

看看: http://maven.apache.org/surefire/maven-surefire-report-plugin/examples/report-custom-location.html

对于 maven-surefire-report-plugin ,配置应包含 outputDirectory 标记,例如:

<outputDirectory>${project.basedir}/test-output</outputDirectory>

或者在使用 maven-surefire-plugin 时,请设置 reportsDirectory 标记,例如:

<reportsDirectory>${project.basedir}/test-output</reportsDirectory>