Unable to send email after tests run using Maven Postman plugin

大城市里の小女人 提交于 2019-12-06 05:33:48

Your Maven execution is never reaching the mail sending plugin because there are test failures. Add these lines in maven-surefire-plugin's configuration section :

                <testErrorIgnore>true</testErrorIgnore>
                <testFailureIgnore>true</testFailureIgnore>

That should solve your problems.

BunnyBugs

Maybe this can help!

Add the failsafe plugin to you pom.xml And that would help maven to generate a report even if there are test failures. Then the Postman plugin will come into action. Also, I am using the below path and tag for email attachments and it works fine for me.

<fileSets>
    <fileSet>
        <!-- Report directory Path -->
        <directory>${project.build.directory}/site/serenity</directory>
        <includes>
            <!-- Report file name -->
            <include>**/serenity-summary.html</include>
        </includes>
        <!-- Use Regular Expressions like **/*.html if you want all the html files to send-->
    </fileSet>
</fileSets>

My failsafe plugin configuration is:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>3.0.0-M3</version>
    <configuration>
        <testFailureIgnore>true</testFailureIgnore>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
</plugin>
<plugin>

All in all, what is happening here is that failsafe will allow maven to execute completely even when there are test failures and then fileset seems to be the correct tag to send an attachment.

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