微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何配置 maven post-man 插件以包含具有动态名称的附件目录?

如何解决如何配置 maven post-man 插件以包含具有动态名称的附件目录?

我正在使用 maven post-man 插件在测试执行完成后通过电子邮件发送测试报告。该插件运行良好,能够从具有固定名称的目录中附加报告。但是,我目前正在使用动态名称生成报告目录,其中时间戳附加到文件名称。例如,如果我的执行在 7 月 29 日晚上 8 点完成,我的报告文件夹目录名称将是“7 月 29 日晚上 8 点报告”。

现在我的问题是如何定义目录路径以包含此动态部分?这是我的 POM.xml 中的插件(检查报告目录路径

<!-- Post-Man plugin -->

        <plugin>
            <groupId>ch.fortysix</groupId>
            <artifactId>maven-postman-plugin</artifactId>
            <executions>
                <execution>

                    <id>send a mail</id>
                    <phase>test</phase>
                    <goals>
                        <goal>send-mail</goal>
                    </goals>
                    <inherited>true</inherited>

                    <configuration>
                        <!-- From Email address -->
                        <from>example.email@gmail.com</from>

                        <!-- Email subject -->
                        <subject>Test Automation Report</subject>

                        <!-- Fail the build if the mail doesnt reach -->
                        <failonerror>false</failonerror>

                        <!-- Email Body Content -->
                        <htmlMessage>
                                <![CDATA[
                                <p>New test build triggered!</p>
                                <p>Attached html file contains the test result status</p> 
                                ]]>
                        </htmlMessage>

                        <!-- host -->
                        <mailhost>smtp.gmail.com</mailhost>
                        <!-- port of the host -->
                        <mailport>465</mailport>
                        <mailssl>true</mailssl>
                        <mailAltConfig>true</mailAltConfig>

                        <!-- Email Authentication(USername and Password) -->
                        <mailuser>example.email@gmail.com</mailuser>
                        <mailpassword>mypassword</mailpassword>

                        <receivers>
                            <!-- To Email address -->
                            <receiver>receiver.email@gmail.com</receiver>
                        </receivers>

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

                    </configuration>
                </execution>
            </executions>
        </plugin>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。