简体   繁体   English

测试用例成功后未生成 Serenity Bdd 报告-(在 Eclipse 和 Jenkins 中)

[英]Serenity Bdd Report not getting generated after testcase is success- (In Eclipse and Jenkins both)

I have created a BDD test case in Eclipse and the maven build for the test case is a success.我在 Eclipse 和 maven 中创建了一个 BDD 测试用例,该测试用例构建成功。 I have also created this same project as a maven job in Jenkins and the build is success for it as well.我还在 Jenkins 中创建了与 maven 作业相同的项目,并且构建也成功了。 Generally from what I have studied, the report should be located in Target>Site>Serenity but for me the report is not getting generated in that location.一般来说,根据我的研究,报告应该位于目标>站点>宁静,但对我来说,报告并没有在那个位置生成。

  1. In Eclipse, there is no error in console log and it shows the following:在 Eclipse 中,控制台日志中没有错误,它显示如下:
    Generating reports view to 'C:\Dev..\target\jbehave' using formats '[stats,console,html,xml,serenityreporter,junitscenarioreporter]' and view properties'{decorateNonHtml=true}'使用格式 '[stats,console,html,xml,serenityreporter,junitscenarioreporter]' 和视图属性'{decorateNonH' 生成报告视图到 'C:\Dev..\target\jbehave'

(I checked and saw that a file named index.html is getting formed in target>jbehave>view folder but that file doesn't have any report contents.) (我检查并看到一个名为 index.html 的文件正在 target>jbehave>view 文件夹中形成,但该文件没有任何报告内容。)

  1. In Jenkins the console log shows the following: Error: Specified HTML directory 'C:/Jenkins/workspace/Devops/.../target/site/serenity does not exit.在 Jenkins 中,控制台日志显示以下内容:错误:指定的 HTML 目录 'C:/Jenkins/workspace/Devops/.../target/site/serenity 不退出。 Build step'Publish HTML reports' changed build result to FAILURE.构建步骤“发布 HTML 报告”将构建结果更改为失败。 Finished:FAILURE完成:失败

I had given the report path in Jenkins in -Post Build Actions- as target>site>serenity initially but seeing that the report instead might be in jbehave folder I changed the path,but still got the following error:我已经在 -Post Build Actions- 中的 Jenkins 中给出了报告路径,最初是目标>站点>宁静,但看到报告可能位于 jbehave 文件夹中,我更改了路径,但仍然出现以下错误:

Error: Specified HTML directory 'C:/Jenkins/workspace/Devops/.../target/jbehave/view does not exit.错误:指定的 HTML 目录 'C:/Jenkins/workspace/Devops/.../target/jbehave/view 不退出。 Build step'Publish HTML reports' changed build result to FAILURE.构建步骤“发布 HTML 报告”将构建结果更改为失败。 Finished:FAILURE完成:失败

Things checked : 1)Checked Jenkins- "the HTML Publisher Plugin" version 1.23 is present.检查的事情:1)检查 Jenkins-“HTML Publisher Plugin”版本 1.23 存在。 So report should be generated.所以应该生成报告。

For Eclipse:对于 Eclipse:

  1. Following properties used in pom.xml: pom.xml 中使用的以下属性:

serenity.version-1.8.21, serenity.maven.version-1.8.21, serenity.jbehave.version-1.35, a-maven-plugin.version=4.1.1

  1. Giving both maven-surefire-plugin and maven-failsafe-plugin(version2.18) in pom.xml在 pom.xml 中同时提供 maven-surefire-plugin 和 maven-failsafe-plugin(version2.18)

  2. Giving "clean verify serenity:aggregate" in goals in run configuration.在运行配置的目标中给出“干净验证宁静:聚合”。

  3. In serenity.properties file added the following 2 lines in an attempt to generate report in an alternate location but still no reports or new folder with report generated.在 serenity.properties 文件中添加了以下 2 行,以尝试在备用位置生成报告,但仍然没有报告或生成报告的新文件夹。

`serenity.test.root = "net.bdd project" `serenity.test.root = "net.bdd 项目"

serenity.outputDirectory = target/site/reports` serenity.outputDirectory = 目标/站点/报告`

What could be the reason for report not getting generating in proper location?报告未在适当位置生成的原因可能是什么? Is it the properties versions in pom.xml?是 pom.xml 中的属性版本吗? or something else to be added in serenity.properties?还是要在 serenity.properties 中添加其他内容? My understanding is that the default location for test report is to be in target>site>serenity.我的理解是测试报告的默认位置是在target>site>serenity。 Is there a way we can manually configure this?有没有办法我们可以手动配置它? If the report is generated in eclipse, will it get generated in jenkins too?如果在 eclipse 中生成报告,是否也会在 jenkins 中生成报告? (using the same project through git in jenkins) (在jenkins中通过git使用同一个项目)

Please provide some inputs as this is my 1st test case and 1st time working on bdd.请提供一些输入,因为这是我的第一个测试用例和第一次在 bdd 上工作。 Really appreciate it.真的很感激。 Thanks!谢谢!

I resolved the above issue and I managed to generate the report in Jenkins.我解决了上述问题,并设法在 Jenkins 中生成报告。 I did the following: 1)Changed the versions in properties in pom.xml file to the following:我做了以下事情: 1)将 pom.xml 文件中的属性版本更改为以下内容:

serenity.version-1.2.4, serenity.maven.version-1.2.4, serenity.jbehave.version-1.1.0, a-maven-plugin.version=4.3.1 serenity.version-1.2.4,serenity.maven.version-1.2.4,serenity.jbehave.version-1.1.0,a-maven-plugin.version=4.3.1

2)In Jenkins post build config, I changed the following: 2)在 Jenkins 构建后配置中,我更改了以下内容:

<alwayslinktolastbuild> true </alwayslinktolastbuild> <keepAll>true</KeepAll> <reportDir>${WORKSPACE}/target/site/serenity</reportDir>

Hope this helps: Thanks!希望这会有所帮助:谢谢! :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM