1

我浏览了许多帖子和博客,但无法通过 Maven生成reportng或报告。testng-xslt最后我得到了这个教程,但没有运气。我无法理解我错过了什么。
这是我尝试过的:它成功地在目标文件夹中生成了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>
4

1 回答 1

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>
于 2015-04-07T14:32:56.017 回答