NEW Posts – Generating Spark and Pdf Extent Report for “Rest Assured with Maven plugin” and “Rest Assured and Cucumber with Maven plugin”
Introduction
This article deals with generating Extent reports for Cucumber-JVM version 6 using the ExtentReports Cucumber Adapter Plugin. The article details out the procedure to create Spark, HTML, Logger, Json and PDF reports. The adapter plugin is available in the tech.grasshopper groupid in Maven repository. This is based on the existing adapter for version 5 with changes made to work with version 6.
IMPORTANT – ExtentReports has been updated to version 5, which has resulted in multiple reporters getting deprecated. Currently this only supports the Spark, Json and Klov reports. The latest adapter version (2.x) generates only these three reports, along with the custom PDF and HTML reports. To work with ExtentReports version 4, add the 1.2.0 adapter version. Refer to the ‘POM Dependencies’ section for more details.
The various steps required for this are to add the adapter dependency to the POM, configure plugin in the runner, enable report generation and modify report settings.
The adapter also generates the new PDF report. Among other new features are the ability to have customized report folder names with timestamps, adding base64 string images and setting the display order of Spark report. Also a technique for merging reports obtained in rerun executions is mentioned. Detailed explanation of these features are available in the separate sections. These features are only available with the adapter version series 2.x.
An article for creating Extent Report using a Cucumber-JVM 7 adapter can be found here and for a Cucumber-JVM 5 adapter can be found here and for a Cucumber-JVM 4 adapter can be found here.
To create Extent Report using a Maven plugin, which uses the Cucumber JSON report and runs in the post-integration-test phase, refer to this article. This plugin is independent of Cucumber version and works for JSON report generated with Cucumber versions 4.3.0 and above.
Source
The source code for the article is located here. The source code for extentreports-cucumber6-adapter plugin is located here. The artifact can be found in Maven at this location.
POM Dependencies
The latest version of extentreports-cucumber6-adapter dependency needs to be added to the POM, to work with ExtentReports version 5.
<dependency> <groupId>tech.grasshopper</groupId> <artifactId>extentreports-cucumber6-adapter</artifactId> <version>2.18.0</version> <scope>test</scope> </dependency>
The POM for this configuration is located here.
The below version of extentreports-cucumber6-adapter dependency needs to be added to the POM , to work with ExtentReports version 4.
<dependency> <groupId>tech.grasshopper</groupId> <artifactId>extentreports-cucumber6-adapter</artifactId> <version>1.2.0</version> <scope>test</scope> </dependency>
Plugin Configuration
The extentreports-cucumber6-adapter plugin needs to be added to the CucumberOptions annotation of the runner.
@CucumberOptions(plugin = {"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"})
Add the colon ‘:’ at the end of the plugin argument, else below exception is thrown.
cucumber.runtime.CucumberException: You must supply an output argument to com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.
Report Activation
First method of activating the report generation is to place extent.properties file in the src/test/resources folder or in the src/test/resources/com/avenstack/adapter folder to be picked up by the adapter. This is ideal for setting up large number of properties. The complete settings for logger and html can be found here. Below examples show the case of the spark report.
extent.reporter.spark.start=true extent.reporter.spark.out=test-output/SparkReport/Spark.html
Second way is to add the required key and value pairs to the System properties. There are again two ways of achieving it.
One way is to add the properties to the configuration section of the Maven Surefire or Failsafe plugin. This is also ideal for setting up large number of properties
<configuration> <systemPropertyVariables> <extent.reporter.spark.start>true</extent.reporter.spark.start> <extent.reporter.spark.out>test-output/SparkReport/Spark.html</extent.reporter.spark.out> </systemPropertyVariables> </configuration>
Other way is to pass the property key-values in the Maven command. This is useful for small number of properties.
mvn clean install -DargLine="-Dextent.reporter.spark.start=true -Dextent.reporter.spark.out=test-output/SparkReport/Spark.html"
Report Settings
The configurations like report activation and location can be mentioned in the extent.properties or using maven settings as shown in the section above. To change settings like theme, title, encoding etc, a separate xml file eg. spark-config.xml is required. The location for this file eg. html report needs to be mentioned as value for the key extent.reporter.html.config.
extent.reporter.spark.config=src/test/resources/spark-config.xml
This xml location key-value pair can also be set using Maven plugin configuration or command line as in the section above. The complete settings for logger and html can be found here.
All that is left to execute the POM and check the reports.
Report Attachments
To add attachments, like screen images, two settings need to be added to the extent.properties. First property, named screenshot.dir, is the directory where the attachments are stored. Second is screenshot.rel.path, which is the relative path from the report file to the screenshot directory. In the below setting, the Spark report (named index.html by default) will navigate to the saved attachments by using the relative path setting.
extent.reporter.spark.out=test-output/SparkReport/
screenshot.dir=test-output/
screenshot.rel.path=../
A more expanded scenario could be storing the images in a folder named ‘screenshots’ and the reports generated in the ‘test-output’ folder. The ‘screenshots‘ and the ‘test-output‘ folders are at the same level. The report will need to step down two folder levels and then move to the required directory.
extent.reporter.spark.out=test-output/SparkReport/
screenshot.dir=screenshot/
screenshot.rel.path=../../screenshot/
If the reports and screenshot are configured to be located in the same folder, then set the screenshot.rel.path value to “./”.
The HTML report also uses the same logic for displaying attachments.
Excel Extent Report [New Feature]
The Excel reporter summarizes the test run results in a dashboard worksheet and other worksheets with feature, scenario, exception, tags, authors and devices details. The dashboard and exception sheets are non-editable.
This report needs to be enabled in the extent.properties file.
extent.reporter.excel.start=true
extent.reporter.excel.out=test output/ExcelReport/ExtentExcel.xlsx
An image of the dashboard worksheet is displayed on the right. A complete sample report can be found here.
This report gives a high level overview of the test execution. This does not provide step level details such as step text, logs, screenshots etc.
Do not use this report if the setup contains multiple runners as concurrent modification of the same excel file will result in errors.
An article dedicated for this feature will be created soon.
PDF Extent Report [New Feature]
The PDF reporter summarizes the test run results in a dashboard and other sections with feature, scenario and step details. The PDF report is needs to be enabled in the extent.properties file.
extent.reporter.pdf.start=true
extent.reporter.pdf.out=test output/PdfReport/ExtentPdf.pdf
A sample report can be found here.
The default color settings can be modified by using a YAML config file, named pdf-config.yaml in the project src/test/resource folder. There are configuration changes in the latest version.
Do not use this report if the setup contains multiple runners as concurrent modification of the same PDF will result in errors. Better solution would be use a Maven plugin for creating just the PDF report or the complete ExtentReport suite.
The detailed documentation for this feature is available in this article.
Device & Author Tags [New Feature]
The device and author information can be added to the feature files as tags for the feature, scenario, scenario outline and examples keyword. This feature needs to be enabled in the extent.properties file. These tags need to be a prefixed with a predefined character sequence and these will be treated separately from the categories tags. This will display the device and author details in respective tabs of the Spark report. Also the scenario counts will be displayed in the dashboard for both.
The extent.reporter.spark.enable.device and extent.reporter.spark.enable.author settings need to be set to true, for the device and author information to be displayed. Both or one of them can be enabled.
extent.reporter.spark.enable.device=true
extent.reporter.spark.enable.author=true
The default prefix for the device tag is ‘@dev_‘ and for the author it is ‘@aut_‘. The case is ignored. For example the device tag will be ‘@dev_iphone’ and author will be ‘@aut_bloch’. These default values can be changed by using the extent.reporter.spark.prefix.device and extent.reporter.spark.prefix.author settings.
extent.reporter.spark.prefix.device=@device_
extent.reporter.spark.prefix.author=@author_
This feature is available from version 1.8.0 and higher. This currently works only for the Spark and HTML reports.
Spark & PDF Report Status Filter [New Feature]
The Spark and PDF report can be filtered by status, with the help of extent.reporter.statusfilter setting in the extent.properties. This takes a comma delmited case insensitive value of statuses. This corresponds to the ExtentReport status. The filter is applied at the feature level.
The valid values are pass, fail, skip, info and warning. The first three statuses will be most relevant. If an invalid status is provided then this will fail silently and this setting will be ignored.
#Failed and skipped
extent.reporter.statusfilter=fail,skip
#Only passed
extent.reporter.statusfilter=pass
This feature is available from version 2.14.3 and higher. This currently works only for the Spark and PDF reports.
Ported HTML Extent Report [New Feature]
The original HTML Extent Reporter was deprecated in 4.1.3 and removed in 5.0.0. The HTML report available in the adapter is based on the same code base and is similar in appearance. The major changes are in the Freemarker template code which have been modified to work with the Extent Reports version 5. The report code can be found at this location.
The HTML report needs to be enabled in the extent.properties file.
extent.reporter.html.start=true
extent.reporter.html.out=test-output/HtmlReport/ExtentHtml.html
To change settings like theme, title, encoding, offlineMode etc, a separate xml file eg. html-config.xml is required. The location for this file eg. html report needs to be mentioned as value for the key extent.reporter.html.config.
extent.reporter.html.config=src/test/resources/html-config.xml
Customized Report Folder Name [New Feature]
To enable report folder name with date and\or time details, two settings need to be added to the extent.properties. These are basefolder.name and basefolder.datetimepattern. These will be merged to create the base folder name, inside which the reports will be generated. The basefolder.datetimepattern value should be a valid date time formatter pattern.
extent.reporter.spark.out=test-output/SparkReport/
screenshot.dir=test-output/
screenshot.rel.path=../
basefolder.name=reports
basefolder.datetimepattern=d-MMM-YY HH-mm-ss
With the above settings, a base folder with the name reports 10-Aug-20 10-25-50 will contain the reports. Screenshots if any, will be located inside the reports 10-Aug-20 10-25-50/test-output folder structure. Similarly the report will be created in the reports 10-Aug-20 10-25-50/test-output/SparkReport folder structure. The point to remember is that the generated folder name should be valid for the underlying file system.
The delimiter between the name and date time pattern can be controlled by using the basefolder.enable.delimiter setting. The default value is true. When this is set to false, there is no space between the name and pattern. The delimiter value can customized by using the basefolder.delimiter setting. The default value is space.
#default is true
basefolder.enable.delimiter=true
#default is space. Custom delimiter
basefolder.delimiter=_
When the basefolder settings are not provided, the reports and related files are generated without any additional folder.
Spark Report View Order [New Feature]
The default tab view order of the Spark reporter is – test, exception, category, device, author, log, dashboard tabs. Currently this order is fixed and cannot be changed. This new feature allows the order to be changed by adding the extent.reporter.spark.vieworder in the extent.properties files. The below value will display the report with the dashboard tab as default.
extent.reporter.spark.vieworder=dashboard,test,category,exception,author,device,log
The value needs to be a comma delimited text without any spaces. Any error in parsing will silently use the default view order. To restrict the number of tabs, just mention the name of the required tabs. For example, if only the test and dashboard views are needed use the below setting
extent.reporter.spark.vieworder=dashboard,test
An example of a complete file can be found here.
Attach Image as Base64 String [New Feature]
This feature can be used to attach images to the Spark report by setting the src attribute of the img tag to a Base64 encoded string of the image. When this feature is used, no physical file is created. There is no need to modify any step definition code to use this. To enable this, use the below settings in extent.properties, which is false by default.
extent.reporter.spark.base64imagesrc=true
The Spark report file size will be pretty large and there could be memory issues if a substantial number of images are present. A generic thumbnail is created and on clicking the image is displayed. To include an image thumbnail, add the following configuration to the Spark configuration file.
<thumbnailForBase64>true</thumbnailForBase64>
Merging Rerun Reports [New Feature]
This feature is not part of the adapter but Spark rerun reports can be merged by using the artifact mentioned in this article. This will require the generation of JSON Extent report in the Cucumber execution.
Below is the setting for JSON report generation.
extent.reporter.json.start=true
extent.reporter.json.out=test-output/JsonReport/Json.json
Environment or System Info Properties
It is now possible to add environment or system info properties in the extent.properties or pass them in the maven command line. These key value pairs are displayed in the ‘Environment’ section of the dashboard page. The key string should begin with the prefix – ‘systeminfo.‘. Be careful of the dot at the end.
These can be added to the extent.properties as following – ‘systeminfo.os=windows‘. For passing the values in maven command use as following – ‘-Dsysteminfo.core=16‘. Both methods can be used simultaneously, the report will display all the values.
Parallel And\Or Multiple Runner Execution
There is no additional configuration settings required for parallel execution with a single or multiple runners. This is also true for single threaded multiple runner execution.
For parallel execution using JUnit refer here and for TestNG refer here.
Screenshots are attached without saving in another path. Thank you for the grasshopper and Mounish. When we moving another location to an HTML file, screenshots are not removed. This is very helpfull.
I am unable to understand your query. Is this a new feature request?
Can you please explain in more details. Thx
Hey Mounish , can u please help how to integrate with karate framework, my @background is not running and all tc are getting skipped
Hi Mounish,
Is there any way to club json reports generated from multiple mvn command and create extent/spark report?.
https://ghauto.tech/2882/ and https://github.com/grasshopper7/extentreports-merge
Thanks for providing such such informative read 🙂
I have a project with more than 1000 test run and people do get lost in big pdf to pin point failed tests. Is there a way to generate 2 PDF by end of execution where 1 pdf contains only failed and 1 contains only pass test cases. I know we have filter feature to just report either pass or fail but didn’t see anything to separate the reports.
help is much appreciated.
Zaheer
Hi, What you are looking for does not currently exist. I will have to think about how it will work. Will get back to you on this. Thx.
Hi, Does it work for you if there is a section which summarizes only the failed and skipped scenarios with links to the details? Similar to the section in the excel report.
Hi,
I’ve a couple of “newbie” questions for you regarding “extentreports-cucumber6-adapter” that we have started using.
1) Is there an online API doc that I could look at to see what additional options I can use, for instance additional ways of adding / formatting step specific logging information ?
[Indenting it from the step entry in the report for example.]
2) Is it possible to access the underlying ExtentReport methods when adding information to the report ? (I have a funny feeling it’s not but I wish to be sure)
3) Is there a way to log JSON messages in the report using scenario.log (or another method) but where the JSON messages is displayed in “pretty-print” format ?
[For example: https://www.extentreports.com/docs/versions/5/java/index.html#codeblock-json%5D
The attempts so far have logged the JSON message but as a straight string without any “pretty-print” formatting that had been applied to it previously.
Many thanks for the help …
The code is pretty simple and does not expose many methods. There is no API doc available.
U can get hold of the ExtentReports instance from a static method in the ExtentService class. Most folks use it in the beforeclass method.
The adapter has 3-4 static methods which expose the current executing scenario, step extent test etc. Do refer to the source code.
There is no such existing option for ‘pretty’ json format. This adapter was created primarily for web ui testing. But yeah I think this formatting can be added to the Spark report but the PDF report implementation will not be possible (page space is too constrained).
Are you using this for some kind of API testing? If you are using Rest Assured for API testing there is a better Extent Report solution available in this website.
Hi,
Thanks for the helpful responses that we’ve been adding into our project code.
I’ve had a look at the plug-in source code, as you suggested, and I’ve been able to get access to the scenario.log command, as well as the ExtentReports class. The latter allowing me to access the underlying MarkupHelper.createCodeBlock method.
Yes, the uses do include API testing. I did see the other plug-in mentioned which does have nice logging of the JSON messages included. The catch was that, for our particular requirements, we need to have the relevant set of messages logged after each step compared to all of them in one go at the top of the test.
Examples of the code used are:
=========================
@Before
public void beforeStartOfTestScenario(Scenario currentTestScenario) {
scenario = currentTestScenario;
}
and
ExtentCucumberAdapter.getCurrentStep().info(MarkupHelper.createCodeBlock(jsonMessageBody, CodeLanguage.JSON));
Possible issue question:
====================
I suspect that this is in the underlying Extent Reports code itself, not the plug-in but I wanted to ask you first (as I’m sure any support request to the other group would have the initial response of “did you check with the plug-in code group”) that when I log a JSON message using the MarkupHelper.createCodeBlock method I get extra “-“‘s added into the output for some reason.
Do you happen to know why this is happening ?
Example code:
ExtentCucumberAdapter.getCurrentStep().info(“****************************************”);
ExtentCucumberAdapter.getCurrentStep().info(“= From Extent Reports site”);
String json = “{‘foo’ : ‘bar’, ‘foos’ : [‘b’,’a’,’r’], ‘bar’ : {‘foo’:’bar’, ‘bar’:false,’foobar’:1234}}”;
ExtentCucumberAdapter.getCurrentStep().info(MarkupHelper.createCodeBlock(json, CodeLanguage.JSON));
ExtentCucumberAdapter.getCurrentStep().info(“****************************************”);
String jsonTwo = “{\”@odata.context\”:\”URL\”,\”Id\”:null,\”IdTwo\”:\”12345\”,\”errors\”:[],\”warnings\”:[],\”information\”:[]}”;
ExtentCucumberAdapter.getCurrentStep().info(“= Another one”);
ExtentCucumberAdapter.getCurrentStep().info(MarkupHelper.createCodeBlock(jsonTwo, CodeLanguage.JSON));
ExtentCucumberAdapter.getCurrentStep().info(“****************************************”);
Example Code Results:
****************************************
= From Extent Reports site
{ –
“foo”: “bar”,
“foos”: [ –
“b”,
“a”,
“r”
],
“bar”: { –
“foo”: “bar”,
“bar”: false,
“foobar”: 1234
}
}
****************************************
= Another one
{ –
“@odata.context”: “URL”,
“Id”: null,
“IdTwo”: “12345”,
“errors”: [ –
],
“warnings”: [ –
],
“information”: [ –
]
}
****************************************
Many thanks
As per my understanding, the ‘-‘ sign is displayed for json arrays or objects to toggle the details visibility. The sign switches to ‘+’ when the details are collapsed. Guess this is a feature rather than a bug. Thanks.
Hi Mounish,
I am able to generate extent report using extent.properties file.
But when I am trying to use spark-config.xml, extent report is not getting generated.
Below are the file content:
1. extent.properties:
extent.reporter.spark.start=true
extent.reporter.spark.config=src/test/resources/spark-config.xml
extent.reporter.spark.out=Reports/Report.html
screenshot.dir=Reports/Screenshots/
screenshot.rel.path=./Screenshots/
2. spark-config.xml (This file is palced at src/test/resources location in project) :
dark
UTF-8
https
Spark Extent
Grasshopper Report
false
Looks good. Any error you are getting?
Have you tried the sample implementation?
No.. I am not getting any error..
I took config and properties file from this post.
Thing is report gets generated if I don’t use config xml.. But when I use config xml it’s not getting generated.
Not sure if I am missing anything here.
Hi, Just ran the code with and without the xml config file. Both generated reports. Do u have a public repo of this code?
No, I don’t have public repo. Could you please share the config xml file which you used
Same as the sample implementation – https://github.com/grasshopper7/cuke6-extent-adapter-report/tree/master/cuke6-extent-adapter-report/src/test/resources
Trying to get an example of how to rerun failed testcases, if anyone has an idea or examples of how to achieve it, that would be very appreciated.
U should look up RerunFormatter – https://github.com/cucumber/cucumber-jvm/blob/main/core/src/main/java/io/cucumber/core/plugin/RerunFormatter.java.
Hi,
I can’t able to run the runner class. I’m getting the below error:
cucumber.runtime.CucumberException: Couldn’t load plugin class: com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter
at cucumber.runtime.formatter.PluginFactory.loadClass(PluginFactory.java:175)
at cucumber.runtime.formatter.PluginFactory.pluginClass(PluginFactory.java:165)
at cucumber.runtime.formatter.PluginFactory.getPluginClass(PluginFactory.java:226)
at cucumber.runtime.formatter.PluginFactory.isFormatterName(PluginFactory.java:195)
at cucumber.runtime.RuntimeOptionsFactory.addPlugins(RuntimeOptionsFactory.java:90)
at cucumber.runtime.RuntimeOptionsFactory.buildArgsFromOptions(RuntimeOptionsFactory.java:37)
at cucumber.runtime.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:24)
at cucumber.api.junit.Cucumber.(Cucumber.java:56)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
at org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:513)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: java.lang.ClassNotFoundException: com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at cucumber.runtime.formatter.PluginFactory.loadClass(PluginFactory.java:173)
… 26 more
below is my POM.xml
4.0.0
tech.grasshopper
extentreports-cucumber6-adapter
2.10.2
extentreports-cucumber6-adapter
https://ghauto.tech/2098/
Cucumber-JVM 6 adapter for Extent Framework
MIT License
http://www.opensource.org/licenses/mit-license.php
Grass Hopper
grass.hopper.moc@gmail.com
Grasshopper
http://ghchirp.tech/
UTF-8
UTF-8
6.10.4
5.0.9
2.3.0
1.0.1
com.aventstack
extentreports
${extent.version}
tech.grasshopper
extent-pdf-report
${pdfreporter.version}
com.aventstack
klov-reporter
${extent.version}
tech.grasshopper
htmlextentreporter
${htmlreporter.version}
io.cucumber
cucumber-java
${cucumber.version}
provided
io.cucumber
cucumber-testng
${cucumber.version}
test
org.mongodb
mongodb-driver
3.3.0
com.fasterxml.jackson.core
jackson-databind
2.12.6.1
test
com.fasterxml.jackson.datatype
jackson-datatype-jsr310
2.10.0
test
io.github.bonigarcia
webdrivermanager
3.8.1
test
org.seleniumhq.selenium
selenium-java
3.141.59
test
org.apache.maven.plugins
maven-compiler-plugin
3.8.1
1.8
1.8
org.apache.maven.plugins
maven-resources-plugin
3.2.0
Please any one help me to resolve this issue
Have u tried running the sample implementation? It should remove all the basic errors. https://github.com/grasshopper7/cuke6-extent-adapter-report
Also your POM is messed up. Refer to this for clarity – https://github.com/grasshopper7/cuke6-extent-adapter-report/blob/master/cuke6-extent-adapter-report/pom.xml.
I am using below dependencies:
tech.grasshopper
extentreports-cucumber6-adapter
2.0.0
test
5.0.4
6.11.0
6.9.0
extent.properties:
extent.reporter.spark.start=true
extent.reporter.spark.out=Reports/TestExecutionReport.html
basefolder.name=Reports/TestExecutionReport
basefolder.datetimepattern=d-MMM-YY HH-mm-ss
screenshot.dir=Screenshots/
screenshot.rel.path=../Screenshots/
Runner:
@CucumberOptions(features = “test-classes/features”,
glue = {“stepdef”},
tags = “@TestExtent”,
plugin = {“com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:”})
on running the test I can see the report getting generated, but I don’t see screenshots.
Is the ‘Reports’ and ‘Screenshots’ folder at the same directory level?
yes.. It Structure should be as below:
Reports
—-TestExecutionReport
—- Reports
—– TestExecutionReport.html
—– Screenshot
TestExecutionReport.html is getting generated under Reports folder, but Screenshot folder is not getting created.
I get only below on running test:
Reports
—-TestExecutionReport
—- Reports
—– TestExecutionReport.html
u are usage of basefoldername is incorrect. Just give a value like ‘reports’. Have a look at the article for details.
Check the sample implementation – https://github.com/grasshopper7/cuke6-extent-adapter-report
Hi Mounish,
I modified extent.properties as below:
extent.reporter.spark.start=true
extent.reporter.spark.out=test-output/Spark/ExtentSpark.html
#test,exception,category,device,author,log,dashboard – default order
extent.reporter.spark.vieworder=dashboard,test,category,exception,author,device,log
screenshot.dir=test-output/
screenshot.rel.path=../
Still screenshot are not getting generated..
Hard to figure out without access to code. If the screenshot is not being generated at all then it is a problem with your code and not the adapter. Or have you set base64 images to true?
Suggest to checkout the sample implementation and give it a try.
Hi Mounish,
I won’t be able to share the code.
Do I need to set base64 image to true?
Or if you can provide some inputs from your experience on where could be the possible issues in my code.. that will be helpful.
I am running my runner file using testng.xml file configured to be picked in surefire plugin. Is this could be the issue.
Thanks,
First make sure why the selenium code is not creating the images. Do u see an exception?
Or they are being generated but u see blank thumbnails? If so what is the src attribute value?
base64 will not generate any physical images but the html will bloat up. Folks use it for creating a single email friendly report.
Hi ,everytime I run the code directly from runner.java it generates separate reports. But when I try running different feature files one after the other through springboot project via api call , it generates a single report during the first execution and overrides the same report on execution of different feature files .
Can you please help me resolve this issue as its little urgent.
Not exactly sure I understand. Are u calling the feature files directly using Cucumber Main class?
Anyways, have u tried with setting the customized report folder name with the timestamp in extent.properties –
basefolder.name=reports
basefolder.datetimepattern=d-MMM-YY HH-mm-ss
Yes a new customized report is generated every time I run the main runner class from Eclipse STS. I have designed a UI where I trigger a set of testcases and generates a new report only during the first execution but the next time I trigger a different set of test cases from the UI it overrides the previous report and does not create a new one .
I have tried this command along with the settings in extent.properties that I mentioned previously. It is generating the reports in separate folders for multiple test runs.
Main.main(“-p”, “com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:”, “-t”, “@website”)
java.lang.IllegalArgumentException: The plugin specification ‘com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:’ has a problem:
‘com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter’ does not implement ‘io.cucumber.plugin.Plugin’.
Plugin specifications should have the format of PLUGIN[:[PATH|[URI [OPTIONS]]]
Valid values for PLUGIN are: default_summary, html, json, junit, message, null_summary, pretty, progress, rerun, summary, teamcity, testng, timeline, unused, usage
PLUGIN can also be a fully qualified class name, allowing registration of 3rd party plugins. The 3rd party plugin must implement io.cucumber.plugin.Plugin
at io.cucumber.core.options.PluginOption.createClassDoesNotImplementPlugin(PluginOption.java:159)
at io.cucumber.core.options.PluginOption.parsePluginName(PluginOption.java:144)
at io.cucumber.core.options.PluginOption.parse(PluginOption.java:105)
at io.cucumber.core.options.RuntimeOptionsBuilder.addPluginName(RuntimeOptionsBuilder.java:68)
at io.cucumber.core.options.CucumberOptionsAnnotationParser.addPlugins(CucumberOptionsAnnotationParser.java:87)
at io.cucumber.core.options.CucumberOptionsAnnotationParser.parse(CucumberOptionsAnnotationParser.java:41)
at io.cucumber.junit.Cucumber.(Cucumber.java:122)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
at org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:513)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
pom.xml ———————
4.0.0
com
graphQL
0.0.1-SNAPSHOT
io.rest-assured
rest-assured
4.4.0
test
io.cucumber
cucumber-java
6.10.4
io.cucumber
cucumber-junit
6.10.4
test
io.cucumber
cucumber-picocontainer
6.10.4
test
org.apache.poi
poi
5.0.0
org.apache.poi
poi-ooxml
5.0.0
com.aventstack
extentreports
5.0.8
tech.grasshopper
extentreports-cucumber6-adapter
2.8.3
com.fasterxml.jackson.core
jackson-databind
2.12.4
org.apache.logging.log4j
log4j-api
2.17.1
org.apache.logging.log4j
log4j-core
2.17.1
org.apache.maven.plugins
maven-compiler-plugin
3.8.1
16
16
org.apache.maven.plugins
maven-surefire-plugin
3.0.0-M5
1
The adapter implements the Plugin interface. https://github.com/grasshopper7/extentreports-cucumber6-adapter/blob/767e4d83aeec92750fc3cd28237f3def1b605ef3/extentreports-cucumber6-adapter/src/main/java/com/aventstack/extentreports/cucumber/adapter/ExtentCucumberAdapter.java#L62
Try the sample implementation. Can u add the runner?
I too having same issue..
Did u give the sample implementation a try?
HI Team
I am using below combination
selenium 4.1.0
extent reporter 6 version
extent report version is 2.1.0
Cucumber version – 6.7.0
Screenshots are not getting captured and displaying broken image in extent report, please help on this.
Most probably it is do with the screenshot path settings in the config file. Which report is not displaying the images? Spark or PDF?
Best would be to share the relevant project in github. Else it is pretty much guess work. Thx.
Hi Mounish,
How can we remove tests from Extent report using Cucumber6 adapter?
I did try ExtentService.getInstance().removeTest() but it needs a parameter which I am not sure of.
Thanks in advance.
Not sure if it is possible or even advisable.
Anyways, it needs the instance of the ExtentTest that you are removing. There is a static getCurrentStep() which you can use – https://github.com/grasshopper7/extentreports-cucumber6-adapter/blob/101a6640730e95c261622a3cd0c94a71ce6c2feb/extentreports-cucumber6-adapter/src/main/java/com/aventstack/extentreports/cucumber/adapter/ExtentCucumberAdapter.java#L489.
Hi Mounish,
How can I add Device/ Author info using the adaptor?
You cannot add device\author information similar to what is possible directly with extent reports, ie on each test. U can add for the whole run by using the system info properties.
Thank you for the reply Mounish. I have one more query – I am generating both Spark and Klov reports in my project. The screenshots appear as expected in Spark but in Klov they appear as x mark in a white box. How can this be fixed?
Thanks in advance!
I may not be of much help as I have minimum experience with Klov nor a working setup. Can u check the path of the image? I am assuming the image will have some reference to a MongoDB.
Hi Mounish,
I had added, run and generated the report ExtentReports Adapter plugin version 6 successfully on multiple devices (Mode parallel)
below is maven dependency:
tech.grasshopper
extentreports-cucumber6-adapter
2.8.4
test
But it generated only one report html file for all devices.
Is there way to generate separate report file fo each device?
I had try separate the runner file and set the name of report by System.setProperty(“extent.reporter.spark.out” ,”differentName”)is different in each runner file but is not useful.
So is it possible to separate the report when run on parallel devices?
Thank you in advance.
This will not be possible. For a test execution, there is only one ExtentReports instance which creates a single consolidated report. Currently reports for each device can be generated by running them separately using tags. It is not a good solution.
Hi , i want to generate separate HTML report for each scenario defined in a feature file. suppose i have 5 scenario ( test case) defined in a feature now i want 5 separate html reports ? i want to run that feature file in one go. As of now i am getting single report having report for all 5 scenario
This is not possible with the current code design. Each execution will create a single html report. One option is to use tags and execute multiple times.
Hi Mounish
I tried generating extent report with 2.8.4 you mentioned
As you can see in below link
https://ibb.co/DtMp6yD (2.8.4) version
1.2.0 report link is here
https://ibb.co/rHvFCYL (verion 1.2.0) extent report
I can see version 1.2.0 is better that 2.8.4 in terms of UI (like green tick)
my question is for version 2.8.4 am I doing anything wrong that it is not giving green ticks or this is the correct UI pls guide
The ticks appeared in the older version of Extent Report 4. The latest version of the adapter supports the latest Extent Report version 5.
hI mounish yes my email id is correct : goyalsumit319@gmail.com.Please mail me thanks
Getting Initialization Failed error after adding Extent Report settings as mentioned in the article.
For more details you can check my code on my GIT repo- https://github.com/gauravpratap01/Cucumber-Selenium-POMFramework/tree/master
Before adding all these extent report settings, I was able to execute.
Use the extent adapter for cucumber version 7 – https://ghauto.tech/3196/.
Issue got fixed after updating the extent adapter for cucumber version 7. But now pdf report is not getting generated and getting below error-
Nov 25, 2021 1:07:08 AM tech.grasshopper.pdf.PDFCucumberReport collectReportConfiguration
INFO: PDF report configuration YAML file not found. Using default settings.
Also, if I add the pdf-config.yaml file mentioned in the doc, then I am getting below error. Do I need to specify about this YAML inside extent.properties file?
Nov 25, 2021 1:16:26 AM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
Cannot create property=summaryConfig for JavaBean=ReportConfig(passColor=05a167, failColor=ff00ff, skipColor=a89132, displayFeature=true, displayScenario=true, displayDetailed=true, displayExpanded=true, summaryConfig=SummaryConfig(title=Cucumber Report, titleColor=null, dateColor=null, timeColor=null, dial=SummaryConfig.DialConfig(featureRanges=0.60 0.85, scenarioRanges=0.60 0.85, stepRanges=0.60 0.85, badColor=null, averageColor=null, goodColor=null), dataBackgroundColor=null), featureConfig=ReportConfig.FeatureConfig(featureCount=null, totalColor=null, durationColor=null, defaultCount=10), scenarioConfig=ReportConfig.ScenarioConfig(scenarioCount=null, totalColor=null, durationColor=null, defaultCount=10), detailedFeatureConfig=DetailedConfig.DetailedFeatureConfig(featureNameColor=null), detailedScenarioConfig=DetailedConfig.DetailedScenarioConfig(featureNameColor=null, scenarioNameColor=null, stepChartBarColor=null), detailedStepHookConfig=DetailedConfig.DetailedStepHookConfig(stepCount=null, stepTextColor=null, stepBackgroundColor=null, hookTextColor=null, hookBackgroundColor=null, durationColor=null, errorMsgColor=null, logMsgColor=null, defaultCount=15))
in ‘reader’, line 1, column 1:
passColor: 05a167
^
Cannot create property=startTimeColor for JavaBean=SummaryConfig(title=Grasshopper PDF Report, titleColor=FF0000, dateColor=969696, timeColor=null, dial=SummaryConfig.DialConfig(featureRanges=0.60 0.85, scenarioRanges=0.60 0.85, stepRanges=0.60 0.85, badColor=null, averageColor=null, goodColor=null), dataBackgroundColor=4F0CC8)
in ‘reader’, line 9, column 4:
title: Grasshopper PDF Report
^
Unable to find property ‘startTimeColor’ on class: tech.grasshopper.pdf.config.SummaryConfig
in ‘reader’, line 13, column 20:
startTimeColor: 000000
^
in ‘reader’, line 9, column 4:
title: Grasshopper PDF Report
^
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:291)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:172)
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:332)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:174)
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:158)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:490)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:429)
at tech.grasshopper.pdf.PDFCucumberReport.collectReportConfiguration(PDFCucumberReport.java:80)
at tech.grasshopper.pdf.PDFCucumberReport.(PDFCucumberReport.java:63)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.flush(ExtentPDFCucumberReporter.java:79)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.access$100(ExtentPDFCucumberReporter.java:19)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:56)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:49)
at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310)
at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226)
at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83)
at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85)
at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:284)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.finishReport(ExtentCucumberAdapter.java:300)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$600(ExtentCucumberAdapter.java:62)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:136)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:133)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.SynchronizedEventBus.send(SynchronizedEventBus.java:47)
at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:90)
at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:77)
at io.cucumber.junit.Cucumber$FinishTestRun.evaluate(Cucumber.java:250)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: Cannot create property=startTimeColor for JavaBean=SummaryConfig(title=Grasshopper PDF Report, titleColor=FF0000, dateColor=969696, timeColor=null, dial=SummaryConfig.DialConfig(featureRanges=0.60 0.85, scenarioRanges=0.60 0.85, stepRanges=0.60 0.85, badColor=null, averageColor=null, goodColor=null), dataBackgroundColor=4F0CC8)
in ‘reader’, line 9, column 4:
title: Grasshopper PDF Report
^
Unable to find property ‘startTimeColor’ on class: tech.grasshopper.pdf.config.SummaryConfig
in ‘reader’, line 13, column 20:
startTimeColor: 000000
^
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:291)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:172)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.newInstance(Constructor.java:306)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:268)
… 36 more
Caused by: org.yaml.snakeyaml.error.YAMLException: Unable to find property ‘startTimeColor’ on class: tech.grasshopper.pdf.config.SummaryConfig
at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:158)
at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:148)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.getProperty(Constructor.java:310)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:231)
… 41 more
Some of the settings have been removed from the YAML file in latest release including ‘startTimeColor’. You can read about them at this link – https://ghauto.tech/2224/, Search for ‘Configuration changes for version 1.3+’.
When you do not include a YAML file in your project, then it pops a warning in the console that default settings will be used. This is not an error.
Agreed, so if I remove the YAML file and just try to execute it without YAML, getting warning for PDF file(as you said it’s not an error).
But PDF is still not getting generated.
https://github.com/gauravpratap01/Cucumber-Selenium-POMFramework/tree/master
I ran your code with the POM from the sample implementation – https://github.com/grasshopper7/cuke7-extent-adapter-report/tree/master/cuke7-extent-adapter-report. Generated both the Spark and PDF reports. Maybe u can use this project to build on further.
Thanks but with your POM, there are lots of errors coming in my project.
Thanks it worked now!!
SCREENSHOT ALIGNMENT IS NOT PROPER ONCE I GENERATE REPORT PLEASE GUIDE
I HAVE ATTACHED IMAGE IN BELOW LINK:
https://ibb.co/wJkyC0v
Which report is this? The old HTML extent report?
No your latest extent reports I created from this current webpage
Plz share your code or report in a public repo. Can u try generating a report with the sample project – https://github.com/grasshopper7/cuke6-extent-adapter-report?
Hi Mounish thanks for your response would like to connect with you over teams or any other medium for same ??
Let me know my personal no : (we can connect after that on teams or any other platform) I will screenshare,Please message me
Is the email id u r using correct?
The screenshots alignmnet is not proper after we generate the file saw everywhere this issue
Screenshot of each step should be present after that step only ? thanks pls help
example
Given user is on application Login Page (—–SCREENSHOT SHOULD BE HERE ————————–)
stepDefinitions.AfterActions.tearDown(io.cucumber.java.Scenario)
(—SCREENSHOT OF FIRST STEP IS ATTACHED HERE—-)
When user Enters the “goel@gmail.com” and “Sumit@88000!” (—–SCREENSHOT FOR 2ND STEP SHOULD BE HERE ———————–)
stepDefinitions.AfterActions.tearDown(io.cucumber.java.Scenario) – –SCREENSHOT OF SECOND STEP IS FOUND HERE—-)
And User Clicks on “Continue” Button
stepDefinitions.AfterActions.tearDown(io.cucumber.java.Scenario)
java.lang.ClassCastException: io.cucumber.messages.Messages$GherkinDocument$Feature cannot be cast to io.cucumber.messages.Messages$GherkinDocument$Feature$Scenario$Examples
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.handleScenarioOutline(ExtentCucumberAdapter.java:318)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.handleTestCaseStarted(ExtentCucumberAdapter.java:152)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$100(ExtentCucumberAdapter.java:58)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$3.receive(ExtentCucumberAdapter.java:97)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$3.receive(ExtentCucumberAdapter.java:94)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.SynchronizedEventBus.send(SynchronizedEventBus.java:47)
at io.cucumber.core.runtime.ThreadLocalRunnerSupplier$LocalEventBus.send(ThreadLocalRunnerSupplier.java:66)
at io.cucumber.core.runner.TestCase.emitTestCaseStarted(TestCase.java:228)
at io.cucumber.core.runner.TestCase.run(TestCase.java:92)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
at io.cucumber.testng.TestNGCucumberRunner.lambda$runScenario$0(TestNGCucumberRunner.java:116)
at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:117)
at io.cucumber.testng.TestNGCucumberRunner.runScenario(TestNGCucumberRunner.java:113)
at com.bycero.Automation.Runner.Runner.runScenario(Runner.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:598)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:824)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.testng.TestRunner.privateRun(TestRunner.java:794)
at org.testng.TestRunner.run(TestRunner.java:596)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:377)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332)
at org.testng.SuiteRunner.run(SuiteRunner.java:276)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
at org.testng.TestNG.runSuites(TestNG.java:1063)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
What could be the reason for this error while executing the runner? Below is snippet of pom.xml:
io.cucumber
cucumber-java
6.8.1
io.cucumber
cucumber-testng
6.8.1
io.cucumber
cucumber-jvm
6.8.1
io.cucumber
cucumber-picocontainer
6.8.1
test
io.cucumber
gherkin
15.0.2
tech.grasshopper
extentreports-cucumber6-adapter
2.0.0
test
com.aventstack
extentreports
5.0.4
Remove the cucmuber-jvm, gherkin and extentreports dependencies. These are transitive dependencies which are automatically fetched. Use the latest adapter jar 2.8.4. If still getting an error, add the relevant scenario outline.
Hi, I am using the extentreports dependency with extentreports-cucumber6-adapter to create a report as the attached image https://www.toolsqa.com/gallery/Extent%20report/9.extent%20report%20testng%20Test%20Steps.png.
I have a problem because I am using a testng listener to retry failed test, but the first execution of these tests are displayed as failed in the report while the testng status is skipped, how can i change that? I want that the first execution of the retry would be shown as skipped and the second execution shows failed or passed.
Thanks!!!
Regarding the link u provided – Getting an access denied message. Maybe u can upload the image to a git repo.
The adapter code will mention the test status from the cucumber execution. This status cannot be changed in the report. So if you are retrying a failed test, the initial run status in the report will remain the same. Also the fact that the test was executed once before implies it has not been skipped, so the report will not be correct. Hope I understood the issue correctly
U can have a look at this – https://github.com/grasshopper7/extentreports-cucumber6-adapter/issues/45#issuecomment-922713720. Kind off similar issue. Thx.
hi i tried implementing all this but test output folder only not getting created can you pls help me here?attached the code used below
pom-
tech.grasshopper
extentreports-cucumber6-adapter
2.8.4
property file under src/test/resources
extent.reporter.klov.start=false
extent.reporter.spark.start=true
extent.reporter.json.start=true
extent.reporter.pdf.start=true
extent.reporter.klov.config=src/test/resources/klov.properties
extent.reporter.spark.config=src/test/java/resources/extent-config.xml
extent.reporter.spark.out=test-output/Spark/ExtentSpark.html
extent.reporter.json.out=test-output/Json/ExtentJson.json
extent.reporter.pdf.out=test-output/PdfReport/ExtentPdf.pdf
#test,dashboard,category,exception,author,device,log
extent.reporter.spark.vieworder=dashboard,test,category,exception,author,device,log
#embed image as base64 string src default is false
#extent.reporter.spark.base64imagesrc=true
screenshot.dir=test-output
screenshot.rel.path=../
systeminfo.os=Windows
systeminfo.version=8.1
#this is optional and creates the report in base folder name with date time format
basefolder.name=CucumberExtent-Reports
basefolder.datetimepattern=d-MMM-YY HH-mm-ss
#this is optional and creates the report in base folder name with date time format
basefolder.name=CucumberExtent-Reports
basefolder.datetimepattern=d-MMM-YY HH-mm-ss
runner class
@CucumberOptions(features = { “src/test/java/resources/features/” }, glue = {
“stepDefinitions” },
plugin = { “com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:”})
Very hard to comment on what you are doing incorrectly without checking the code. U can either share your repository or check out the sample implementation https://github.com/grasshopper7/cuke6-extent-adapter-report.
hi
given the repo link below.Could you please check from ur side and let me know why am not able to generete the reports?
https://github.com/Ayush13Gupta/CucumberFramework.
Thanks
Fix the dependencies. U have both junit and testng. Choose one and develop accordingly, it is just unnecessary.
U r processing screenshots using a custom code which creates a html target with a image. Then it uses the log() method instead of attach(). The extent adapter uses the attach event to handle screenshots, which is never triggered.
i changed the capture sc method as u suggested.now my masterhooks class look like below.Also changed dependecy.copied from ur pom from github.still its not generating .. 🙁
@After
public void tearDownAndScreenshotOnFailure(io.cucumber.java.Scenario scenario) {
//String site;
try {
if(driver != null && scenario.isFailed()) {
//scenario.embed(((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES), “image/png”);
//BasePage.captureScreenshot(scenario);
TakesScreenshot ts = (TakesScreenshot) driver;
byte[] screenshot = ts.getScreenshotAs(OutputType.BYTES);
scenario.log(“Taking a screenshot!”);
scenario.attach(screenshot, “image/png”, this.site);
driver.manage().deleteAllCookies();
driver.quit();
driver = null;
}
if(driver != null) {
driver.manage().deleteAllCookies();
driver.quit();
driver = null;
}
} catch (Exception e) {
System.out.println(“Methods failed: tearDownAndScreenshotOnFailure, Exception: ” + e.getMessage());
}
}
Add the changes to your repo. will have a look
Hi,
Observed one issue with PDF format – which is ultimately causing non generation of PDF.
If user calls flush() twice. Getting below exception.
This exception is due to wrong usage but that can be handled in ExtentPDFReporter code base?
tech.grasshopper.reporter.ExtentPDFReporter flush
SEVERE: An exception occurred
java.io.IOException: The TrueType font null does not contain a ‘cmap’ table
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapImpl(TrueTypeFont.java:561)
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:541)
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:527)
at org.apache.fontbox.ttf.TTFSubsetter.(TTFSubsetter.java:90)
at org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.subset(TrueTypeEmbedder.java:346)
at org.apache.pdfbox.pdmodel.font.PDType0Font.subset(PDType0Font.java:256)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1349)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1328)
at tech.grasshopper.reporter.ReportGenerator.generate(ReportGenerator.java:92)
at tech.grasshopper.reporter.ExtentPDFReporter.flush(ExtentPDFReporter.java:105)
at tech.grasshopper.reporter.ExtentPDFReporter.access$100(ExtentPDFReporter.java:20)
at tech.grasshopper.reporter.ExtentPDFReporter$1.onNext(ExtentPDFReporter.java:84)
at tech.grasshopper.reporter.ExtentPDFReporter$1.onNext(ExtentPDFReporter.java:77)
at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310)
at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226)
at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83)
at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85)
at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:284)
What is the reason for calling flush twice or even multiple times? also this method is not exposed to the user in the adapter, so not sure how this is possible.
Most hard to decipher errors in PDF report is due to multiple instances trying to write to the same physical file. Guessing this is what happens with multiple flush calls.
Due to mistake or oversight, It was observed in one lengthy flow where user ended/flush in suite listener and in it’s own test class as well. Exception could be avoided with appropriate handling in ExtentPDFReporter .
— Simple Code Snipped to reproduce–
ExtentReports extent = new ExtentReports();
ExtentSparkReporter spark = new ExtentSparkReporter(“target/Spark.html”);
ExtentPDFReporter pdf = new ExtentPDFReporter(“target/SparkPdf.pdf”);
extent.attachReporter(pdf, spark);
extent.createTest(“DescTest”, “Something is going to be placed”).pass(“Passed”);
extent.flush();
extent.flush();
Will look into it, though not convinced by multiple flush calls. Back to my initial query, the adapter does not expose these methods. Are u referring to PDF report generation for Extent (without cucumber) -> https://ghauto.tech/2555/?
hi
i have implemented this and my report is generatig fine but how to get screenshots added. do we need to include any othr code to hooks for screenshots? as i dont see screenshots getting attached to my report just with those 2 lines in properfies file?
please help
thanks
which report? spark or pdf?
have a look at the sample implementation https://github.com/grasshopper7/cuke6-extent-adapter-report/blob/e0c86fb4d353e8f800e8d6dc0ca1a5ebf07a475b/cuke6-extent-adapter-report/src/test/java/stepdefs/Stepdefs.java#L161
I will try to update the grasshopper version and execute code. Also will execute sample version.
Thanks a lot for reply
Hi Mounish,
Thank you so much for excellent documentation. I have implemented extent reports as documented but I am unable to view neither generated report nor test-output folder. Throughout execution my test cases are passed successfully.
IDE: Intellij
Java: 11.0.11
Cucumber version: 6.9.1
Grasshopper: 2.6.0
just a word of caution. extent reports has been tested with java 8. Not sure if it works with 11 properly.
Hi Mounish,
I have degraded Java version to Java 8. Cloned “cuke6-extent-adapter-report” project from GitHub. When I have executed code reports are generated successfully but when I have configured similar settings in My project. Below error is displaying. Please help me resolve the issue.
Aug 24, 2021 4:08:51 PM tech.grasshopper.pdf.PDFCucumberReport collectReportConfiguration
INFO: PDF report configuration YAML file not found. Using default settings.
Aug 24, 2021 4:08:51 PM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
tech.grasshopper.pdf.exception.PdfReportException: No steps present for scenario – To verify that user able to validate Isprocessed is checked only for matched
at tech.grasshopper.pdf.pojo.cucumber.Scenario.checkData(Scenario.java:68)
at tech.grasshopper.pdf.data.ReportData.checkData(ReportData.java:39)
at tech.grasshopper.pdf.PDFCucumberReport.(PDFCucumberReport.java:52)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.flush(ExtentPDFCucumberReporter.java:68)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.access$100(ExtentPDFCucumberReporter.java:17)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:45)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:38)
at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310)
at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226)
at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83)
at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85)
at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:284)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.finishReport(ExtentCucumberAdapter.java:300)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$600(ExtentCucumberAdapter.java:62)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:136)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:133)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:93)
at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:74)
at io.cucumber.junit.Cucumber$RunCucumber.evaluate(Cucumber.java:237)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
Does this scenario have any steps mentioned in the feature file – ‘To verify that user able to validate Isprocessed is checked only for matched’
Yes!!!! As per requirement I have given below scenario:
Scenario Outline: To verify that user able to validate Isprocessed is checked only for matched basket count
Great… But my query is still not answered. Does it have steps inside it? If u have steps in it, then there could be a bug in the reporting code. To verify it, I would need a sample of this scenario outline.
If u do not include this scenario outline in the test run, is the pdf report generated?
Hi Mounish,
I have observed the reports, ExtentSpark.html and ExtentJson.json reports are successfully but ExtentPdf.pdf report is not generating.
Hi Mounish,
If I am using Scenario, PDF report is generated :).
Thank you so much for helping. Appreciated your work :).
Hi Mounish,
Thank you so much for this documentation. I have implemented extent reports as mentioned in the documentation.
I am not facing any error while execution, my test cases are passed. But report is not generating not even test-output folder.
IDE: Intellij
Cucumber version: 6.9.,1
Grasshopper: 2.6.0
┌───────────────────────────────────────────────────────────────────────────────────┐
│ Share your Cucumber Report with your team at https://reports.cucumber.io │
│ Activate publishing with one of the following: │
│ │
│ src/test/resources/cucumber.properties: cucumber.publish.enabled=true │
│ src/test/resources/junit-platform.properties: cucumber.publish.enabled=true │
│ Environment variable: CUCUMBER_PUBLISH_ENABLED=true │
│ JUnit: @CucumberOptions(publish = true) │
│ │
│ More information at https://reports.cucumber.io/docs/cucumber-jvm │
│ │
│ Disable this message with one of the following: │
│ │
│ src/test/resources/cucumber.properties: cucumber.publish.quiet=true │
│ src/test/resources/junit-platform.properties: cucumber.publish.quiet=true │
└───────────────────────────────────────────────────────────────────────────────────┘
Hard to debug without more info. Can u share the minimum test code in a git repo?
Also consider upgrading to 2.8.2.
Have u tried with the sample report implementation. https://github.com/grasshopper7/cuke6-extent-adapter-report. Use this as a base to build upon. Thx
Hi,
I have been trying to use the extent report adapter in IntelliJIDEA IDE however getting the below error message in the console while it builds.
java: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x725f1920) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x725f1920
Can you please help me with this issue?
The POM dependency for this adapter is as:
tech.grasshopper
extentreports-cucumber6-adapter
2.8.2
test
Added @CucumberOptions in test runner class as:
@CucumberOptions(
features = {“src.test.resorces/Features”},
glue = {“stepDefintions”, “AppHooks”},
plugin = {“pretty”,
“com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:”}
)
What version of java are u using? I believe extent reports version 5 only supports\tested with Java 8. https://github.com/extent-framework/extentreports-java/blob/6d004b293b3f49969ba4e429960822f783a3c87a/pom.xml#L97
Hello, thank you for your hard work on this article.
I’ve tried attaching the screenshot and it works properly, but I want to know if it’s possible to attach plain text to the report? my code for that part looks like this :
scenario.attach(sharedState.responseData, “text/plain”, “API Response”);
what I want to attach are some response JSON from API testing, and from my slight peeking into the adapter code I don’t think it currently processes that MIME type.
Any help would be appreciated.
It does not handle that mime type.
U could pass the response data to scenraio.log(), the report should display it as text.
How do u want it to be handled, response data embedded as a text file? Or something else.
It doesn’t have to be separated file, I just want the response data to be displayed as part of the report (inside the HTML would be okay).
“CodeBlock” / “Details text”-equivalent from the Extent Reports example would meet my needs.
https://www.extentreports.com/docs/v5/wiki/spark/spark.html
when u use scenario.log() u will get the same result. I think the two will be similar.
Sorry, I wasn’t aware that you mentioned scenario.log() on your earlier reply, I thought it was for CLI logging. Thank you! it works flawlessly.
Ok I got it when we generate extent report then we need to specify where screenshots are present inside report folder other wise it will not find as I checked in console thanks
Hi,
Iam confused can you tell me what is
screenshot relative path means in the properties file i read many blogs can you tell me in simple words
Refer to the section ‘Report Attachments’ in the article. My apologies but I cannot make it any more simpler than this.
Hi
I have created one afterhook(tear down method )in cucumber for taking screenshots and attaching it to steps in extent report.Issue is along with my feature files steps related to tear down method are also getting attached in extent report any way to include only feature files steps thanks
Steps and any hooks, containing text or images etc, will be added by default and there is no mechanism to switch this off. Only hooks which do not have any ‘displayable’ content are not visible.
Hi Evertime I generate extent reports it overrides previous report how to generate the report according to time stamp please tell and thanks for creating these reports
Look up “Customized Report Folder Name” section in the article
great worked
java.lang.ClassCastException: io.cucumber.messages.Messages$GherkinDocument$Feature cannot be cast to io.cucumber.messages.Messages$GherkinDocument$Feature$Scenario$Examples
What could be the reason for this error? Below is snippet of pom.xml:
io.cucumber
cucumber-java
6.10.4
io.cucumber
cucumber-core
6.10.4
io.cucumber
cucumber-spring
6.10.4
test
io.cucumber
cucumber-junit
6.10.4
test
tech.grasshopper
extentreports-cucumber6-adapter
2.8.2
test
com.aventstack
extentreports
5.0.8
junit
junit
4.13.2
test
org.freemarker
freemarker
2.3.30
Can u add more details about the stacktrace? Line number, class etc would be helpful
https://github.com/grasshopper7/cuke6-extent-adapter-report/blob/master/cuke6-extent-adapter-report/src/test/resources/pdf-config.yaml , this is not reachable
Fixed. Thx for pointing it out.
Hi Mounish,
When adding screen shot from afterstep hook.
For each step the adaptor is adding one extra step.
Hi, I do not understand what u mean by extra step? Do u mean the hook method signature?
Hi
What I meant was lets say I have 6 steps in my Scenario and I want to attach a screen shot in extent report for all 6 steps. In order to take abd attach the screen shot I have used AfterStep hook method where I am taking the screen shot and then attaching it to the extent report.
Ideally screen shot should attach next to each step but right now it creating one extra step in extent report for each time step hook method is getting called means if i hv 6 steps then i. The report it is displaying 12 steps
The afterstep hook or any hook with contents, are displayed separately. As u mentioned the screenshot is taken in the afterstep hook then it is logical that it is separate from the step. It is actually 6 steps and 6 hooks.
Also the step count shown in the Spark report dashboard is not correct for any test execution with hooks. It shows the sum of step and hook count. It is a bug for multiple extent report versions.
Thanks Mounish.
For rhe update.
Hopefully it will be updated in future release.
Hi Mounish,
When I am trying to add a screenshot for a failed step using afterstep hook. At that time in Spark report one extra step is getting added with screenshot.
Please refer below for example:
Then Verify Physician Details in People Tab
Expected Values: User: yogesh.dhami@ascentfactory.com
Expected Values: Speciality: Cardiology
Expected Values: FirstName: Test_fKkZH
Expected Values: NPI: 2106270326
Expected Values: Title: QA
Expected Values: Prefix: Dr.
Expected Values: MiddleName: M
Expected Values: URL: https://kineticmw-embarkqa.azurewebsites.net/
Expected Values: Type: Physician
Expected Values: Suffix: Sr.
Expected Values: MedicalDegree: MD
Expected Values: LastName: Automation_fKkZH
Expected Values: SubSpeciality: Pediatric
Expected Values: Password: RuleBreaker@89
java.lang.NullPointerException
at CucumberFrameWork.BDD.StepDefinition.EmbarkSteps.EmbarkPeoplePageStepDefinition.verify_physician_details_in_people_tab(EmbarkPeoplePageStepDefinition.java:46)
at ?.Verify Physician Details in People Tab(file:///C:/Test_Automation/CucumberGuice/src/test/resources/BDD/Feature/Embark.feature:29)
CucumberFrameWork.BDD.StepDefinition.Hook.afterStep(io.cucumber.java.Scenario)
Attached Screenshot from Page Object
base64 img
Hello Mounish,
Encountered an error for running multiple testrunner in the testNG suite.
Jun 20, 2021 8:25:57 AM tech.grasshopper.pdf.PDFCucumberReport createReport
SEVERE: An exception occurred
java.io.IOException: The TrueType font null does not contain a ‘cmap’ table
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapImpl(TrueTypeFont.java:553)
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:533)
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:519)
at org.apache.fontbox.ttf.TTFSubsetter.(TTFSubsetter.java:90)
at org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.subset(TrueTypeEmbedder.java:321)
at org.apache.pdfbox.pdmodel.font.PDType0Font.subset(PDType0Font.java:256)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1349)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1328)
at tech.grasshopper.pdf.PDFCucumberReport.createReport(PDFCucumberReport.java:100)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.flush(ExtentPDFCucumberReporter.java:69)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.access$100(ExtentPDFCucumberReporter.java:17)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:45)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:38)
at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310)
at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226)
at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83)
at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85)
at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:284)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.finishReport(ExtentCucumberAdapter.java:300)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$600(ExtentCucumberAdapter.java:62)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:136)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:133)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
Seems to be the same issue. PDF report generation through the adapter does not work for multiple runners
Hi,
Please help. What extra should I add.
I am getting error: Jun 11, 2021 1:02:12 PM tech.grasshopper.pdf.PDFCucumberReport collectReportConfiguration
INFO: PDF report configuration not found. Using default settings.
I have added
tech.grasshopper
extentreports-cucumber6-adapter
2.6.0
test
extent.properties file:
extent.reporter.spark.start=true
extent.reporter.spark.out=test-output/SparkReport/Spark.html
extent.reporter.spark.config=src/test/resources/extent-config.xml
extent.reporter.spark.out=test-output/SparkReport/
screenshot.dir=test-output/
screenshot.rel.path=../
extent.reporter.pdf.start=true
extent.reporter.pdf.out=test output/PdfReport/ExtentPdf.pdf
#basefolder.name=reports
#basefolder.datetimepattern=d-MMM-YY HH-mm-ss
extent.reporter.spark.vieworder=dashboard,test,category,exception,author,device,log
systeminfo.os=Windows
systeminfo.user=Naveen
systeminfo.build=1.1
systeminfo.AppName=AutomationPractice
What error? Please add the error? Is the report being generated or not?
Use the latest version, it is clearly mentioned in the post.
Hi I using below java code for attaching screenshot in the report
********************************************
scenario.attach(takeScreenShot(), “image/png”, scenario.getName());
public static byte[] takeScreenShot() {
return ((TakesScreenshot)driver).getScreenshotAs(OutputType.BYTES);
}
***********************
Attachment added successfully in the report as expected, here the question is why package details also printed a head of the screenshot as like below. Actually my screenshot name is “screenshot”
innova.hooks.Hooks.afterAnnotation(io.cucumber.java.Scenario)
screenshot
Which report? This is actually the name “assigned” to the hook in the report. This is the hook method with the classname. I will have to check about the image name inclusion.
Thanks a lot for this documentation. Is it possible to club the reports together?
Situation:
1. We execute all automation scripts in first run and for that a corresponding extent report is being generated.
2. In second run, we execute only failed cases and for this the extent report is being generated and overrides the earlier report as we are using the same location. Why we are overriding means, after every run we trigger the email with latest report.
I understand, using basefolder.datetimepattern. we can create report with different dates.
Can we club two reports? or any better solution?
Which reports are u generating? PDF or Spark or both?
There maybe a way to combine both reports using the JSON report. I will have a look at it.
Remind me if, I do not get back to you in a couple of days.
I am using Spark report. If there is any possible solution please share with us.
Have been swamped with my day job and did not get much time. Seems the concept will work but just not had the time to finish it. Will give it a shot this weekend.
https://github.com/grasshopper7/jsonmergeextent refer to the readme file for details.
Hi Mounish,
I am using cucumber data table in some scenarios in my project. even if one data table row gets failed and others are passed the complete step and all the data table rows are marked as failed in extent report. Is there any work around to make only the failed data table row as failed and others as passed in extent report?
Thanks,
Manoj
Cucumber datatables are meant to provide the whole tabular data to a step. It is not meant for repeating execution across row data. The scenario outline is the ideal candidate for this purpose.
Not sure what your exact requirement is but using an examples table with the scenario outline should work out.
Thanks for your response and time Mounish.
If I use scenario outline, all the steps in the scenario along with background steps will get executed for all the examples and the precondition steps will take more time. I Just want the final step in the scenario to get executed repeatedly with the data mentioned in the data table. if step fails for one row, only the step and failed row should be marked as an failed in the report and other passed rows should be marked as an pass in the report. Below is my scenario.
Scenario: Validate Error codes: Research Payments
Given User login to OPP
And user navigates to homepage
When user selects user type as “Applicable Manufacturer or Group Purchasing Organization”
And user navigates to Bulk File Upload Submissions Page
And user enters payment details
And user navigates to Review File Status Page
And User searches for “Research Payments” and “Submitted with Errors” records
And user selects a File and downloads error log
Then verify the error log document for error codes
| Error Desc | ErrorCode |
| MisMatch State and Zipcode | E-9049 |
| Blank State | E-611 |
| PI_ZIP_CODE_VALUE_CHECK_INVALID | E-975 |
| PI_STATE_VALUE_CHECK_INVALID | E-974 |
| PI_STATE_CHECK_BLANK | E-674 |
| Invalid State | E-911 |
| Invalid Zipcode | E-912 |
| ForeignCountry_Valid State/ZIP | E-9038_1 |
| PI_STATE_ZIPCOD | E-9050_1 |
| RECIPIENT_STATE_NULL_CHECK NCR Entity | E-9038_2 |
| PI_STATE_ZIPCODE_CHECK 2 | E-9050_2 |
The report in its current form will not support treating datatable row as a step. This will need changes in the cucumber code because as far as I know there is no event triggered when a datatable row data is consumed and executed. The extent report depends on these cucumber events for data collection.
There are ways u can mimic the requirement.
1. One method could be repeat each row as a separate verification step. Seems basic but matches exactly what u r looking for. Creating the repeated steps is pretty easy by using excel and merging columns.
2. With the datatable step use a soft assertion. The step may fail but the message will clearly state the rows which have failed.
Thank You Mounish
Using soft assertion with data table step solved my problem. As you mentioned it is clearly indicating which row has been failed.
Hi Mounish,
After upgrading extentreports-cucumber6-adapter version from 2.5.0 to latest versions i am getting below error. The same code is working fine in version 2.5.0 and it’s older versions. Can you please help me in fixing this issue?
Error :
[ERROR] setUpClass(runner.TestRunner_TestNG) Time elapsed: 1.7 s <<< FAILURE!
io.cucumber.core.exception.CucumberException: java.lang.ExceptionInInitializerError
Caused by: java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException
Runner Class :
package runner;
import java.io.File;
import org.testng.annotations.Test;
import io.cucumber.core.logging.*;
//import cucumber.api.CucumberOptions;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import managers.FileReaderManager;
@Test
@CucumberOptions(features = "src\\test\\resources\\Features", glue = "stepDefinitions", plugin = {"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:",
"rerun:target/failed_scenarios.txt" })
public class TestRunner_TestNG extends AbstractTestNGCucumberTests {
}
Thanks,
Manoj
DO u have the complete stack with line numbers etc? What is the setupClass() method doing? Does it have some static initialization? What is the cucumber version?
Hi Mounish,
1) I am using latest cucumber version (6.10.4).
2) I am not getting complete stack trace as it is showing as null.
3) Set up class in inside AbstractTestNGCucumberTests and it is getting failed while initalizing TestNGCucumberRunner class. I am getting error ‘InvocationTargetException’ at Plugins plugins = new Plugins(new PluginFactory(), runtimeOptions) in TestNGCucumberRunner class.
4) Same code is working fine in extentreports-cucumber6-adapter version 2.5.0 and lower. It is throwing exception in all the latest versions.
Thanks,
Manoj
Ran the sample report (https://github.com/grasshopper7/cuke6-extent-adapter-report) using adapter version 2.8.1 and cucumber versions 6.10.4, 6.10.0 and 6.9.0. I am getting the exception stacktrace in spark and pdf reports. Also no plugin errors in console.
Only reason I can think off is u might have a mix of dependency versions.
Thank You Monish.
I am not able to figure out any dependency issue in my POM file. Please see my POM file below.
4.0.0
com.ops
cucumber
0.0.1-SNAPSHOT
cucumber
http://www.example.com
UTF-8
1.8
1.8
mulesoft-releases
MuleSoft Repository
https://repository.mulesoft.org/nexus/content/repositories/public/
org.apache.poi
poi-ooxml
3.17
io.cucumber
cucumber-picocontainer
6.10.4
test
org.testng
testng
7.4.0
test
org.seleniumhq.selenium
selenium-java
3.12.0
io.cucumber
cucumber-java
6.10.4
org.apache.poi
poi
3.16
org.apache.poi
poi-ooxml
3.16
org.apache.poi
poi-ooxml-schemas
3.16
org.apache.poi
poi-scratchpad
3.16
org.apache.poi
poi-excelant
3.16
org.freemarker
freemarker
2.3.30
io.cucumber
cucumber-core
6.10.4
io.rest-assured
rest-assured
3.0.6
com.fasterxml.jackson.core
jackson-databind
2.2.2
com.googlecode.json-simple
json-simple
1.1.1
commons-io
commons-io
2.6
io.cucumber
cucumber-testng
6.10.4
com.aventstack
extentreports
5.0.8
tech.grasshopper
extentreports-cucumber6-adapter
2.8.0
com.github.javafaker
javafaker
0.16
org.fluttercode.datafactory
datafactory
0.8
io.github.bonigarcia
webdrivermanager
2.2.4
ru.yandex.qatools.ashot
ashot
1.5.2
com.github.mkolisnyk
cucumber-runner
1.3.5
${project.basedir}
${project.build.directory}
**/*.properties
maven-resources-plugin
3.0.2
maven-compiler-plugin
3.8.0
maven-jar-plugin
3.0.2
maven-install-plugin
2.5.2
maven-deploy-plugin
2.8.2
maven-site-plugin
3.7.1
maven-project-info-reports-plugin
3.0.0
org.apache.maven.plugins
maven-surefire-plugin
2.22.1
${testNGFile}
true
src/test/java/Results/${ResultsFile}
src/test/resources/extent-config.xml
The mulesoft repo location is no longer required with latest adapter version. There is no need to explicitly add testng, cucumber-core, extentreports and freemarker as they are all transitive dependency.
Have u tried without the mkolisnyk cucumber-runner?
Can u run the sample implementation with this POM, maybe that isolates the problem.
Hello Monish,
Hope You r doing good. Need ur advise I am getting the below error
[INFO] ——————————————————-
[INFO] T E S T S
[INFO] ——————————————————-
[INFO] Running RunnerFile.RunnerTest
May 31, 2021 4:39:51 PM tech.grasshopper.pdf.PDFCucumberReport collectReportConfiguration
INFO: PDF report configuration YAML file not found. Using default settings.
May 31, 2021 4:39:51 PM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(ArrayList.java:862)
at java.util.Collections.min(Collections.java:596)
at tech.grasshopper.pdf.data.ReportData.populateDashboardData(ReportData.java:94)
at tech.grasshopper.pdf.data.ReportData.populateSectionData(ReportData.java:51)
at tech.grasshopper.pdf.PDFCucumberReport.(PDFCucumberReport.java:51)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.flush(ExtentPDFCucumberReporter.java:68)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.access$100(ExtentPDFCucumberReporter.java:17)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:45)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:38)
at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310)
at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226)
I am using 1 Runnerfile Only, need to run in parallel using Junit Only
tags = “@Login and @Home”, > Fails
tags = “@Login”, > Pass
plugin = { “pretty”,”com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:”})
POM
4.13.1
6.9.0
3.8.1
2.22.2
tech.grasshopper
extentreports-cucumber6-adapter
2.8.1
test
com.github.ralfstuckert.pdfbox-layout
pdfbox2-layout
1.0.0
org.apache.pdfbox
pdfbox
2.0.20
org.apache.maven.plugins
maven-compiler-plugin
${maven.compiler.version}
UTF-8
${java.version}
${java.version}
org.apache.maven.plugins
maven-surefire-plugin
${maven.surefire.version}
org.apache.maven.plugins
maven-failsafe-plugin
3.0.0-M4
integration-test
**/*RunnerTest.java
methods
4
true
Thank You VS
Hi.. Can u share the code or a simplified version which is causing the exception in a github repo. I have fixed this similar error multiple times and this keeps cropping up. Guess I am missing something basic in my logic.
Hai bro,
Please help me out here. I am using ExtentReport on Cucumber 6.10.3. And upon running my runner file ‘NoSuchElementException’ is throwing. I will try to include as much data i can regarding the issue. Please help me out. I kinda looked almost all sites for this solution. No luck up to now
ERROR THROWING IN CONSOLE
===========================
May 29, 2021 5:19:26 PM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
java.util.NoSuchElementException
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:970)
at java.base/java.util.Collections.min(Collections.java:601)
at tech.grasshopper.pdf.data.ReportData.populateDashboardData(ReportData.java:94)
at tech.grasshopper.pdf.data.ReportData.populateSectionData(ReportData.java:51)
at tech.grasshopper.pdf.PDFCucumberReport.(PDFCucumberReport.java:51)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.flush(ExtentPDFCucumberReporter.java:68)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.access$100(ExtentPDFCucumberReporter.java:17)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:45)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:38)
at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310)
at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226)
at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83)
at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85)
at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:284)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.finishReport(ExtentCucumberAdapter.java:300)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$600(ExtentCucumberAdapter.java:62)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:136)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:133)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:93)
at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:74)
at io.cucumber.junit.Cucumber$RunCucumber.evaluate(Cucumber.java:237)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
┌───────────────────────────────────────────────────────────────────────────────────┐
│ Share your Cucumber Report with your team at https://reports.cucumber.io │
│ Activate publishing with one of the following: │
│ │
│ src/test/resources/cucumber.properties: cucumber.publish.enabled=true │
│ src/test/resources/junit-platform.properties: cucumber.publish.enabled=true │
│ Environment variable: CUCUMBER_PUBLISH_ENABLED=true │
│ JUnit: @CucumberOptions(publish = true) │
│ │
│ More information at https://reports.cucumber.io/docs/cucumber-jvm │
│ │
│ Disable this message with one of the following: │
│ │
│ src/test/resources/cucumber.properties: cucumber.publish.quiet=true │
│ src/test/resources/junit-platform.properties: cucumber.publish.quiet=true │
└───────────────────────────────────────────────────────────────────────────────────┘
FAILURE TRACE
============
java.lang.IllegalArgumentException: Test name must not be null or empty
at com.aventstack.extentreports.util.Assert.notEmpty(Assert.java:12)
at com.aventstack.extentreports.ExtentTest.(ExtentTest.java:96)
at com.aventstack.extentreports.ExtentReports.createTest(ExtentReports.java:107)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.createFeature(ExtentCucumberAdapter.java:327)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.handleStartOfFeature(ExtentCucumberAdapter.java:306)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.handleTestCaseStarted(ExtentCucumberAdapter.java:160)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$100(ExtentCucumberAdapter.java:62)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$3.receive(ExtentCucumberAdapter.java:106)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$3.receive(ExtentCucumberAdapter.java:103)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.SynchronizedEventBus.send(SynchronizedEventBus.java:47)
at io.cucumber.core.runtime.ThreadLocalRunnerSupplier$LocalEventBus.send(ThreadLocalRunnerSupplier.java:66)
at io.cucumber.core.runner.TestCase.emitTestCaseStarted(TestCase.java:228)
at io.cucumber.core.runner.TestCase.run(TestCase.java:92)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:73)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:151)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:135)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at io.cucumber.junit.Cucumber.runChild(Cucumber.java:200)
at io.cucumber.junit.Cucumber.runChild(Cucumber.java:90)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at io.cucumber.junit.Cucumber$RunCucumber.evaluate(Cucumber.java:235)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Runner.java
———————-
package Runner;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(
tags=”@Reistration”,
monochrome = true,
features = “feature”,
glue = {“stepDefinition”},
plugin = {
“com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:”,
“json:target/cucumber-report.json”,”html:target/cucumber.html”})
public class Runner {
}
po.xml
======
4.0.0
hms
ehealth_automation
0.0.1-SNAPSHOT
jar
ehealth_automation
http://maven.apache.org
UTF-8
org.seleniumhq.selenium
selenium-java
3.141.59
io.cucumber
cucumber-core
6.10.3
io.cucumber
cucumber-java
6.10.3
io.cucumber
cucumber-junit
6.10.3
test
io.cucumber
cucumber-gherkin
6.10.3
junit
junit
4.13.2
com.aventstack
extentreports
5.0.8
tech.grasshopper
extentreports-cucumber6-adapter
2.8.1
<!– 1.0.0 –>
commons-io
commons-io
2.4
maven-compiler-plugin
3.5.1
1.8
1.8
org.apache.maven.plugins
maven-resources-plugin
2.7
org.apache.maven.plugins
maven-failsafe-plugin
3.0.0-M4
integration-test
verify
I followed the Test name is not empty failure trace via googling for long time. No solutions. I dont know where i screwed up. Please help
U will have a scenario or scenario outline in the feature file which have no name in front of the keyword.
Scenario: |TYPE IN NAME HERE|
Remove the cucumber-gherkin and extentreports dependency from the POM. They will be bought in automatically.
Thanks man.
You are a lucky charm, i guess.
Because after posting the qn here, things started to work out for me.
The answer you posted here is correct. And b4 i saw the answer i kinda figured it out like , the Scenario name should be in line with the keyword of it.
Thanks man .. Thanks a lot
Sorry, Feature name should be inline with the Feature keyword.
I entered the value in the next line. Thats why i am constantly getting the Test Name Should Not Be Empty issue
Thanks Once Again
Hi,
We have a set up for getting extent reports with screenshots in a relative folder.
If we want to send the report through email, is it possible to just send one file with the screenshots.
At the moment, We are trying to send the whole folder as a zip file as the screenshots do not come if we send the report file alone.
Thanks,
Use base64 images to avoid zipping the report, refer to “Attach Image as Base64 String” in the article. The flip side is that the report size will increase based on number of images.
Else u can use the PDF report which is based on MIT license software, refer to “PDF Extent Report” section in the article. The image will be embedded in the PDF report. This does not require base64 image strings.
Hi Mounish,
I hope you are doing good. I am using ExtentReports Adapter plugin for Report generation, Not able to see the attached screenshots in Extent report in Jenkins, but I can able to see while executing in local reports
Please help me out of this. thanks.
I used Publish HTML Reports in Jenkins.
below is the extent properties.
extent.reporter.avent.start=false
extent.reporter.bdd.start=false
extent.reporter.cards.start=false
extent.reporter.email.start=false
extent.reporter.html.start=true
extent.reporter.klov.start=false
extent.reporter.logger.start=true
extent.reporter.tabular.start=false
extent.reporter.avent.config=
extent.reporter.bdd.config=
extent.reporter.cards.config=
extent.reporter.html.config=
extent.reporter.klov.config=
extent.reporter.logger.config=
extent.reporter.tabular.config=
extent.reporter.email.config=
extent.reporter.avent.out=test-output/AventReport/
extent.reporter.bdd.out=test-output/BddReport/
extent.reporter.cards.out=test-output/CardsReport/
extent.reporter.email.out=test-output/EmailReport/ExtentEmail.html
extent.reporter.html.out=test-output/HtmlReport/ExtentHtml.html
extent.reporter.logger.out=test-output/LoggerReport/
extent.reporter.tabular.out=test-output/TabularReport/
screenshot.dir=test-output/screenshots/
screenshot.rel.path=../screenshots/
#screenshot.dir=test-output/HtmlReport/screenshots/
#screenshot.rel.path=../HtmlReport/screenshots/
below is snapshot code
public void takeSnap(Scenario scenario) throws IOException {
String scenarioName = scenario.getName().replace(” “, “”).replace(“:”, “”);
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File(getCurrentDir() + “/target/FailureScreenShots/” + scenarioName + “.png”));
System.out.println(“inside screenshot”);
final byte[] screenshot= ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
scenario.attach(screenshot, “image/png”, “snap”);
}
Which version of the adapter are u using? Is the image being generated in jenkins execution?
What is the value of src attribute of the images – inspect element on the thumbnail? try to figure the relative path to the image with the report folder as the starting point.
I am using 1.2.0 version , Yes the images are capture in the screenshots folder.
folder structure is
Screen shots are available in — test-output/screenshots
the html reports are available in – test-output/HtmlReport/ExtentHtml.html
the thumbnail path is — http://XXXXX:8080/job/AP-UI-Tests-4/410/screenshots/embedded1.png
below is the extent properties values ,
screenshot.dir=test-output/screenshots/
screenshot.rel.path=../screenshots/
Note : I am keep maintain the past HTML reports for each builds. Please help me to address the issue , I am struck with no glue thanks.
If u paste this path in the browser does it display the larger image? Can u paste the complete img html?
Looking at the image url, the test-output folder is missing. Maybe this could be the issue.
Complete Image path in as per the Jenkins http://XXXXX:8080/job/AP-UI-Tests-4/ws/APPortal/test-output/screenshots/embedded1.png.
If I give like below in properties file it showing the screen shot in Jenkins report file
screenshot.dir=test-output/screenshots/
screenshot.rel.path=../ws/APPortal/test-output/screenshots/
above one is right way? if use this in local the screenshot not showing.
But as per the document they have mentioned below
screenshot.dir=test-output/screenshots/
screenshot.rel.path=../screenshots/
what should I do to show the screenshot in local & Jenkins?
Have a look at the ‘Report Activation’ section in the article. You can pass the screenshot.rel.path value in the maven command line. If u are using profiles then u can add the properties in the configuration section of ur surefire or failsafe plugin. Both the options are in the section I mentioned. This way the value mentioned in the extent.properties for the property will not be considered.
@mounish
Any way to merge two extent reports.
Ex : Job 1 – Generate first extent report
Job 2 – Generate second extent report
Job 3 – Merge (first + second) extent report and create new extent report.
Not sure if this is possible but there is a JSONFormatter which stores the test run result in JSON format. This can be generated through the adapter for each run. list = extent.getReport().getTestList();
U can access these JSON reports by using extentreport API (lookup the test code) to combine them. Something like extent = new ExtentReports();
extent.createDomainFromJsonArchive(JSON_PATH); List
Maybe this works.
Thank you Mounish for this article. Very nicely written & explained.
According to cucucmber-jvm 6 release notes, the support of cucumber.options (as VM argument) had been removed – https://github.com/cucumber/cucumber-jvm/blob/main/release-notes/v6.0.0.md.
Has anybody tried passing tags or glue as VM argument using cucumber 6?
Thank you.
Best,
Anuj
Have not tried it. Will have a look at it. U will get a much quicker response if u post on stackoverflow. Thx.
This works Mounish. This is the syntax: -Dcucumber.filter.tags=”@TAG1″
I have posted a question related to PDF file (displayDetailed: false) at “https://ghauto.tech/2224/”. Please look into it & let me know if you have an update.
Thank you.
Best,
Anuj
Hi,
I am getting this error:
io.cucumber.core.exception.CucumberException: java.lang.NoSuchFieldError: VERSION_2_3_29
at io.cucumber.core.plugin.PluginFactory.newInstance(PluginFactory.java:118)
at io.cucumber.core.plugin.PluginFactory.instantiate(PluginFactory.java:97)
at io.cucumber.core.plugin.PluginFactory.create(PluginFactory.java:62)
at io.cucumber.core.plugin.Plugins.createPlugins(Plugins.java:32)
at io.cucumber.core.plugin.Plugins.(Plugins.java:25)
at io.cucumber.junit.Cucumber.(Cucumber.java:162)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: java.lang.NoSuchFieldError: VERSION_2_3_29
When using
tech.grasshopper
extentreports-cucumber6-adapter
1.2.0
test
com.aventstack
extentreports
4.1.7
Do you know what the problem is?
I wanted to use extent reports version 4 for the html report. Alternatively when trying to use version 5 with:
tech.grasshopper
extentreports-cucumber6-adapter
2.7.0
test
com.aventstack
extentreports
5.0.7
I get this error:
Cannot resolve com.github.ralfstuckert.pdfbox-layout:pdfbox2-layout:1.0.0
Let me provide u a workaround for the second problem first (missing jar). Refer to this link for root cause and temporary solution – https://github.com/grasshopper7/extentreports-cucumber6-adapter/issues/36. Will be providing a permanent solution with a new release, hopefully in a couple of days.
Coming to the first issue, this refers to the freemarker version dependency mismatch. Refer to this – https://github.com/email2vimalraj/CucumberExtentReporter/issues/96. Remove the explicit dependency extentreports declaration in the project POM for version 5.0.7. The adapter will bring in the appropriate extent version as a transitive dependency.
Hi Mounish,
Actually, I am getting below error at the start of execution with single runner file. can you please let me know what is wrong there?
Dependencies used:
extentreports-cucumber6-adapter : 2.6.0
cucumber-java : 6.9.1
tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(ArrayList.java:862)
at java.util.Collections.min(Collections.java:596)
at tech.grasshopper.pdf.data.ReportData.populateDashboardData(ReportData.java:93)
at tech.grasshopper.pdf.data.ReportData.populateSectionData(ReportData.java:49)
at tech.grasshopper.pdf.PDFCucumberReport.(PDFCucumberReport.java:50)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.flush(ExtentPDFCucumberReporter.java:68)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.access$1(ExtentPDFCucumberReporter.java:60)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:45)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:1)
at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310)
at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226)
at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83)
at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85)
at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:284)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.finishReport(ExtentCucumberAdapter.java:300)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$600(ExtentCucumberAdapter.java:62)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:136)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:133)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:93)
at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:74)
at io.cucumber.testng.TestNGCucumberRunner.finish(TestNGCucumberRunner.java:126)
at io.cucumber.testng.AbstractTestNGCucumberTests.tearDownClass(AbstractTestNGCucumberTests.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:61)
at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:366)
at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:320)
at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:217)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:130)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.runSuites(TestNG.java:1069)
at org.testng.TestNG.run(TestNG.java:1037)
at core.FinarkRunner.execute(FinarkRunner.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.runSuites(TestNG.java:1069)
at org.testng.TestNG.run(TestNG.java:1037)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:283)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:377)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:138)
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:465)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:451)
Please use latest version 2.7.0. This issue should be fixed in this version. Thx
Hi Mounish,
I got the things whichever you have mentioned. I have one more question:
Can we add our custom logs to extent reports using your adapter? What I have done is
if (originaltitle = expectedtitle){
test.log(Status.pass,”Yesy1″);
} else {
test.log(Status.Fail,”yesy2″);
}
This is not getting loaded onto the reports and still shows as “Pass”. Can you please help in this
This will not work as none of the extent objects is available outside the adapter class. Also this is not correct method. You should pass or fail the test in the cucumber step code. If u want to add log messages use the scenario.log() method.
Hi Mounish,
Thanks for the reply. I tried your method and it worked well. However, can you please help with letting me know on how do I fail a scenario step?
For example:
Given I navigate
Then I check title – I am looking at failing here and display in report using scenario.log
Basically I want in the report to be displayed as fail along with message for its failure using scenario.log
How do I perform?
Throw an assertion with the message constructor. It should fail the step and the report should display the message and stack. No need for scenario.log. This is usually used for adding a custom message or additional information to a specific step.
Hi Mounish, I am not getting any screenshots added only in the folder mentioned and also report doesn’t contain any screenshots
Hi, I just tried it successfully with the sample implementation and your settings. Can u try with the same and let me know? If your code is available in a public repo I can have a look. Thx
Hi Mounish,
Thanks for the reply. I have another query to ask. I am trying to perform Assert (soft ) since I do not want to stop the execution , however, the report doesn’t show the test case/feature as “Failed”. It displays as “Pass”. If I use Assert.all(); then it completely halts the execution. I am using Assert.assertEquals(); to verify for title among others.
Can you please advice on how do I move ahead with this?
As per my understanding, checking is only performed when assertall() is called. Just adding the assertions to soft assert will not fail your scenario. The assertall() has to be explicitly called. Maybe u can call this at the last step of your scenario.
Hi Mounish, Thanks for the response. I tried with that and it so happens that both the asserts will be shown into one test step in the report. How do I solve this?
What I have done is:
1. Cucumber step definitions – Used @After annotation and called SoftAssert.AssertAll().
2. I have two step definitions (Given and Then) both have assert check
3. Extent Report generates with display of assert only in the “Then” step instead of both “given” and then”
Can you please help
Hi, Can u create a simple and minimal example in a public git repo? Much easier to look at code and try it out. Thanks.
Hi Mounish,
I have a problem with using the adapter. Can you please help. I am unable to attach screenshot to the Spark reporter. Below is the properties file and the code written in the main class
extent.properties –
extent.reporter.spark.start=true
extent.reporter.spark.output=test-output/SparkReport/Spark.html
extent.reporter.spark.config=src/test/resources/extent-config.xml
extent.reporter.spark.out=test-output/SparkReport/
screenshot.dir=test-output
screenshot.rel.path=../
basefolder.name=CucumberExtent-Reports
basefolder.datetimepattern=d-MMM-YY HH-mm-ss
extent.reporter.pdf.start=true
extent.reporter.pdf.out=test-output/PdfReport/ExtentPDF.pdf
extent.reporter.spark.vieworder=dashboard,test,category,exception,author,device,log
systeminfo.os=Windows
systeminfo.user=Adarsh
systeminfo.build=1.1
Code in the main class –
import java.io.IOException;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import io.cucumber.java.After;
import io.cucumber.java.AfterStep;
import io.cucumber.java.Scenario;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import frameworkHelpers.DriverManager;
@CucumberOptions (
features = {“src/test/resources/features”},
glue = {“stepDefinitions”},
plugin = {“com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:”},
monochrome = true)
public class TestRunner extends AbstractTestNGCucumberTests{
private Scenario scenario;
DriverManager DM = new DriverManager();
@After
public void takeScreenshot(Scenario scenario) throws IOException {
if(scenario.isFailed()) {
byte[] src=((TakesScreenshot) DriverManager.driver).getScreenshotAs(OutputType.BYTES);
scenario.log(scenario.getName()+ “is failed”);
scenario.attach(src,”image/png”, scenario.getName()+ “.png”);
}
}
}
Have two questions:
1. Am I writing something wrong in the above code and properties file
2. Can we add more properties in the extent.properties file? like more dynamic in nature.
Are the image files generated in the CucumberExtent-Reports\d-MMM-YY HH-mm-ss\test-output folder? Are u getting blank screenshots in the report?
Exelent article. I have a question for you:
How i can attach an author and device to the final extent report generated?
Thanks!
As per my understanding, author and device are at the extent test level. With the current code and setup adding these details to the tests are not possible as all the inputs are basically coming from the feature file.
This would need some kind of framework to pass these values in the feature file using tags with a prefix. Doable but do not think it is robust. Or adding these details in the config file with key as the test name.
Hi Mounish ,
Could you please guide me to solve the below mentioned issues
1. In the pdf report I got the screen shots of failed scenarios. But they appears too smaller. I need to zoom it to 800% to see the image clearly. Am I missing any settings here?
2. Could you please provide an example that shows a scenario as skipped in the pdf report?
3. In the pdf report, for scenarios with status “PENDING / UNDEFINED” the corresponding step is marked as failed but without any stack trace or error message. Only a blank line is shown. When I checked the spark report its showing “Step pending / Step undefined”
4. In the pdf report, for scenarios with status “AMBIGUOUS” the corresponding step is marked as passed. The same status is seen in spark report also. For example if the scenario has 4 steps and in the third step AmbiguousStepDefinitionsException occurs the first 3 steps will get passed, 4th step will be skipped and the status of scenario will be shown as skipped. But if the scenario has 4 steps and in the fourth step AmbiguousStepDefinitionsException occurs all the 4 steps will get passed and the status of scenario will be shown as passed.
Attaching a sample step definition also
@Given(“I have a ambiguous step”)
public void i_have_a_ambiguous_step() {
System.out.println(“ambiguous”);
}
@Given(“^I have a ambiguous step$”)
public void i_have_another_ambiguous_step() {
System.out.println(“ambiguous”);
}
Please find below my dependencies in the gradle file
implementation ‘org.seleniumhq.selenium:selenium-server:3.141.59’
implementation ‘io.github.bonigarcia:webdrivermanager:4.3.1’
implementation ‘tech.grasshopper:extentreports-cucumber6-adapter:2.7.0’
implementation ‘com.github.ralfstuckert.pdfbox-layout:pdfbox2-layout:1.0.0’
testImplementation ‘junit:junit:4.13.2’
testImplementation ‘io.cucumber:cucumber-java:6.10.1’
testImplementation ‘io.cucumber:cucumber-junit:6.10.1’
Hi,
1. The images are small by design, no setting involved. This is due to space constraints in a PDF page and the issue with handling page breaks. I am working on creating an appendix for larger images (optional if the user desires) and also for other trimmed data like stacks, logs, docstring etc etc plus better utilization of page space by splitting rows. But the downside is that the pdf file will become huge for any realistic project size as folks love taking screenshots. This artifact was a custom report created for a client project and was primarily meant for a high level decision making. It did not have images and other technical details were minimal. You can say an email friendly report. When I ported to an open source version (client one was in itext), it has morphed into a monster as more details are added.
2. In testng u can throw a SkipException in the step, in junit I think u need to play around with the Assume object. Easiest way to have one skipped step then the scenario will be skipped.
3. Yeah, this is a bug, the exception\message line is missing for pending\undefined\skipped steps. Should be fixed in future release.
4. Someone else had also mentioned a similar issue for Spark without any replication details, but I could not replicate it. Will look into it.
The PDF report only supports failed, passed and skipped (default) results. Adding further to point 1, these 3 results matter most for decisions. The other results are more technical details useful for the automation engineer\developer.
Thanks a lot for the prompt response. To replicate point 4 please copy paste the feature file and step definitions given below
Scenario: This is a sample scenario
Given I have a first step
And I have a second step
And I have a ambiguous step
Then I have a ambiguous scenario
@Given(“I have a first step”)
public void i_have_a_first_step() {
System.out.println(“first”);
}
@And(“I have a second step”)
public void i_have_a_second_step() {
System.out.println(“second”);
}
@And(“I have a ambiguous step”)
public void i_have_a_ambiguous_step() {
System.out.println(“ambiguous”);
}
@And(“^I have a ambiguous step$”)
public void i_have_another_ambiguous_step() {
System.out.println(“ambiguous”);
}
@Then(“I have a ambiguous scenario”)
public void i_have_a_ambiguous_scenario() {
System.out.println(“ambiguous scenario”);
}
I have mentioned two cases in point 4. In order to replicate the second case just swap the positions of step 3 and step 4 in the feature file.
Please feel free to ask if you need any additional details. Hats off for the wonderful report and the hard work behind that. Eagerly waiting for the new features(mentioned in point 1) in the future versions.
Check out version 2.8.0, currently available in maven. Zoomed images in separate section. Contents are split between pages to save space. Skipped, pending and undefined stacks\messages are displayed. Have opened an issue for ambiguous scenario case and debug in a bug fix release.
Hi,
Able to take and save screenshot using @After and @Before method but,
How to take screenshot at any location in particular step in step definition?
I am using cucumber-Junit framework.
Create a before hook with the scenario parameter. Cucumber will automatically inject the Scenario object. Store the injected scenario in an instance variable. Access this instance variable in any steps.
Hi Mounish,
Thanks for this great guide. It’s very helpful.
Seems like I’m getting the same issue as Prateek whereby my screenshot is not attached to the report.
Here’s my extent.properties file:
————————————————————
extent.reporter.spark.start=true
extent.reporter.spark.out=output/TestReport.html
extent.reporter.spark.config=src/test/resources/extent-config.xml
screenshot.dir=output/
screenshot.rel.path=../
extent.reporter.spark.vieworder=dashboard,test,category,exception,author,device,log
————————————————————
Here’s my setup to get the screenshot when test fails:
————————————————————
public void afterScenarioFinish(Scenario scenario) throws IOException {
if (scenario.isFailed()) {
final byte[] ts = ((TakesScreenshot) DriverManager.getDriver()).getScreenshotAs(OutputType.BYTES);
scenario.attach(ts, “image/png”, “screenshot”);
}
}
————————————————————
I also noticed that my screenshot name is embedded1.png. Is this the default naming? any chance we can change it like the test report? Thanks for your help. Appreciate it very much.
everything looks good. Which adapter version are u using?
I am assuming the thumbnail is also blank or is it something else? Can u check the value of the image ‘src’ by choosing the ‘inspect element’ option? As a last option u can download the sample implementation and try it out.
The ’embedded’ is by default. It has no logic behind it. There is an issue open to make it customizable but I have not got around to it. U are most welcome to send in a PR. Thanks.
Hey Mounish,
Thanks for your reply. Yes, the thumbnail is blank. Value of src is as below:
src=”../embedded1.png”
Noted on the screenshot naming 🙂
Your settings are not correct. I missed it in your first post. Change this setting – ‘extent.reporter.spark.out=test-output/SparkReport/’. U can use any name for the ‘SparkReport’ folder. The ‘screenshot.rel.path’ sets the relative path for the images from the report location. With your current setup it is dropping one level down from where the images are.
There should be a way to have report and images in same folder but I am not 100% sure. Will need to try it out myself but unfortunately I am pressed for time for a couple of days.
Aa okay. Got it. Thanks Mounish. No worries.
Hi Mounish, Could you please suggest the solution for below error
[ERROR] Failed to execute goal on project TEST1: Could not resolve dependencies for project TEST1:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at tech.grasshopper:extentreports-cucumber6-adapter:jar:2.6.0 -> tech.grasshopper:extent-pdf-report:jar:1.5.0 -> tech.grasshopper:cucumber-pdf-report:jar:1.7.0 -> com.github.ralfstuckert.pdfbox-layout:pdfbox2-layout:jar:1.0.0: Failed to read artifact descriptor for com.github.ralfstuckert.pdfbox-layout:pdfbox2-layout:jar:1.0.0: Could not transfer artifact com.github.ralfstuckert.pdfbox-layout:pdfbox2-layout:pom:1.0.0 from/to jitpack.io (https://jitpack.io): Transfer failed for https://jitpack.io/com/github/ralfstuckert/pdfbox-layout/pdfbox2-layout/1.0.0/pdfbox2-layout-1.0.0.pom: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
Could you please suggest the solution
The pdfbox-layout jar is present in the jitpack repo and not maven. U can check the POM with the exact repository details. If u r behind a firewall, u need to work with the network guys to get this enabled. Thx
Hi Mounish,
I have got a request for renaming of the term ‘Scenarios’ to ‘Testcase’ in the extent reports.
Is that something possible through configuration?
I am using Extent reports and cucumber 6(grasshopper).
Any help will be greatly appreciated.
I looked up and I was pointed to a github link https://github.com/extent-framework/extentreports-java/issues/68 and it was closed.
U can add custom javascript in the extent-config.xml as suggested in the github issue. It needs to go into the document ready function inside the ‘scripts’ xml tag. I have not tried it but u can look at this stack post of how it works – https://stackoverflow.com/questions/62173494/how-to-customise-the-extent-report-by-removing-unwanted-graphs-and-extra-space.
Hi Mounish,
I am using extent reports with grasshopper adapter. (cucumber6-adapter)
Is there a way we can have the extent reports to generate a unique name for the files for every run. At the moment, the report name is taken from the config file and the file is getting over written. We want to store some of the previous runs and hence want to know if we can have different file name for every run(preferably timestamp).
Thanks,
Kam
This exact feature already exists which appends the user defined timestamp pattern. Search for ‘Customized Report Folder Name’ in the article.
Hi Mounish,
Thanks. that was helpful.
Is there a way we can get all the reports (timestamp folders)to be inside a common folder ..
At the moment, the timestamp folder is getting generated but i want all the timestamp directories to be generated in a single folder. Is there a way I can mention this?
Would that be possible?
Thanks,
Prasana.
I do not think this is possible. U can create an issue in the repo. Will have a detailed look at it. thx
Extent email report is not generated in Extent Cucumber adapter , Could please provide the guide to implement that
Correct me if I am wrong but in Extent version 5, the email report is available in the professional version which needs a license. I do not have access to one and currently I am not planning to get one. Sorry.
thanks for the reply mounish, I am using extent adapter version 6 , Anyway you are saying that we need license to get email report right?..
Do you know how to get the license or help me on this?
U can refer to this – https://www.extentreports.com/compare-extentreports-editions-2/. FYI, I am not in anyway associated with the developers or team at ExtentReport. Thx
thanks Mounish for the kind reply. Will have a look on this.
@mounish
Any plans on handling multiple runner class support by the plugin. To support to generate reports for the failed rerun feature.
Multiple runners are currently supported for the SPark report but not for PDF. If u want a PDF report with multiple runner use the Maven plugin which generates repot from the cucumber json file – https://ghauto.tech/2114/. Rerun results merging was something I was looking at earlier, had planned to use the current Spark report as the basis. Problems started as the ExtentTest instance is shared with all other reports and cloning this was problematic. Also using Spark as a basis does not convey the actual meaning of the original\rerun results. Serializing the object into XML\JSON and recreating may solve the cloning issue, as this functionality already exists, but need a new report format. Any ideas?
Then how to generate Spark report with multiple runners. And Spark reports Merge features with different JSON files that have the same ID and Merge features and scenarios from different JSON.
HI Mounish,
I am using the below maven dependency and able to create reports HTML & PDF reports. But PDF is only generated when a single test is run. PDF report is corrupted when Test Suite is run. Can you please advise.
tech.grasshopper
extentreports-cucumber6-adapter
2.6.0
test
and the settings in extent.properties as follows
extent.reporter.pdf.start=true
extent.reporter.pdf.out=test output/PdfReport/ExtentPdf.pdf
Are u using multiple runners? Are u getting any stacktrace?
Yes Mounish. I am running multiple runners.
Feb 10, 2021 1:41:55 PM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
tech.grasshopper.pdf.exception.PdfReportException: java.io.IOException: The TrueType font null does not contain a ‘cmap’ table
at tech.grasshopper.pdf.PDFCucumberReport.createReport(PDFCucumberReport.java:115)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.flush(ExtentPDFCucumberReporter.java:66)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.access$1(ExtentPDFCucumberReporter.java:57)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:42)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:1)
at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310)
at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226)
at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83)
at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85)
at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:284)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.finishReport(ExtentCucumberAdapter.java:296)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$6(ExtentCucumberAdapter.java:295)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:132)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:1)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:93)
at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:74)
at io.cucumber.testng.TestNGCucumberRunner.finish(TestNGCucumberRunner.java:126)
at io.cucumber.testng.AbstractTestNGCucumberTests.tearDownClass(AbstractTestNGCucumberTests.java:53)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:61)
at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:366)
at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:320)
at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:217)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:130)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.runSuites(TestNG.java:1069)
at org.testng.TestNG.run(TestNG.java:1037)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:284)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:119)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548)
Caused by: java.io.IOException: The TrueType font null does not contain a ‘cmap’ table
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapImpl(TrueTypeFont.java:553)
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:533)
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:519)
at org.apache.fontbox.ttf.TTFSubsetter.(TTFSubsetter.java:90)
at org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.subset(TrueTypeEmbedder.java:346)
at org.apache.pdfbox.pdmodel.font.PDType0Font.subset(PDType0Font.java:256)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1349)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1328)
at tech.grasshopper.pdf.PDFCucumberReport.createReport(PDFCucumberReport.java:111)
The PDF report will not work for multiple runners. U can use the PDF maven plugin instead. Concurrent access of the same PDF file messes things up. Can u run the report with just one runner and let me know if u are getting the same error.
Hi Mounish,
I am using extent reports using cucumber6-adapter(grasshopper) in an offline machine.
The reports are not the same due to the machine not having internet connection. I can see the errors in the browser console with respect to the font awesome and js files, it refers to.
Can you tell me if there is a solution to this. Can I make the adapter generate a report in an offline mode.?
Thanks,
Kam.
U can try with adding this setting (offlineMode) to the extent-config.xml- %offlineMode%true%/offlineMode%. Change the ‘%’ to opening and closing XML brackets. The comments section of the site removes them. Let me know if this works. Thx.
Hi Mounish,
Yes, It does. Thank you again.
I am using extentreports-cucumber6-adapter with version 1.2.0.I am able generate html report but pdf is not getting generated. what could be the issue?
PDf report requires extent version 5 which is included in adapter version 2.0.0 onwards. Use the latest one.
Hi Mounish,
My TestRunner method is throwing the below error
io.cucumber.core.exception.CucumberException: java.lang.NoClassDefFoundError: io/reactivex/rxjava3/subjects/PublishSubject
at io.cucumber.core.plugin.PluginFactory.newInstance(PluginFactory.java:119)
Caused by: java.lang.NoClassDefFoundError: io/reactivex/rxjava3/subjects/PublishSubject
at com.aventstack.extentreports.ReactiveSubject.(ReactiveSubject.java:28)
dependencies:
io.cucumber / cucumber-java / 6.7.0
io.cucumber / cucumber-jvm-deps / 1.0.6
com.aventstack / extentreports / 5.0.6
plugin = { “com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:”, “summary” }
Report are not generated.
Please, can you check?
Thank
U are missing the rxjava jar. U do not need to add the cucumber-jvm-deps and extentreports dependency. They will be pulled in transitively. Add the extentreports-cucumber6-adapter\2.6.0, cucumber-java\6.7.0, cucumber-junit or cucumber-testng\6.7.0. Refer to this – https://github.com/grasshopper7/cuke6-extent-adapter-report/blob/master/cuke6-extent-adapter-report/pom.xml.
Hi @Mounish
Thanks you for your response, i add rxjava jar to pom, remove cucumber-jvm-deps and extentreports dependency, I have extentreports-cucumber6-adapter\2.6.0, cucumber-java\6.7.0, cucumber-junit 6.7.0 and dont have vimalselvam dpendency, when run project i got the next error:
io.cucumber.core.exception.CucumberException: java.lang.NoClassDefFoundError: com/aventstack/extentreports/reporter/ReporterConfigurable
Caused by: java.lang.NoClassDefFoundError: com/aventstack/extentreports/reporter/ReporterConfigurable
at com.aventstack.extentreports.service.ExtentService.getInstance(ExtentService.java:34)
rxjava jar is bought automatically by extentreport jar which is already included in the adpater POM, u do not have to mention it explicitly. Can u update\refresh the maven dependencies for the project?
Hi Mounish,
I remove rxjava from pom, refresh maven dependencies, execute mvn clean install and error persist. I upload pom to git https://github.com/blasterino1/hello-world/blob/master/pom.xml
Will have a look. What happens when u execute the runner directly?
I am unable to get 6.7.0 from maven, POM is showing error. Try with 6.8.0 or 6.6.1
Hi @Mounish
I try with 6.8.0 or 6.6.1 and error are not displayed.
Thanks
Hi Mounish,
My writeExtentReport method is throwing the below error
java.lang.NoClassDefFoundError: com/aventstack/extentreports/reporter/ExtentHtmlReporter
at com.vimalselvam.cucumber.listener.Reporter.loadXMLConfig(Reporter.java:66)”
The Spark report is getting generated correctly though. Below are my POM dependencies, could you please help me resolve this error?
io.cucumber
cucumber-java
6.6.0
io.cucumber
cucumber-testng
6.6.0
io.cucumber
cucumber-jvm-deps
1.0.6
com.vimalselvam
cucumber-extentsreport
3.1.1
com.aventstack
extentreports
5.0.6
remove the vimalselvam dpendency. if u r using the extent adapter plugin nothing else is required.
Thank you!
@Mounish
Any way to transfer the system variable (OS, OS Version, Browser and Browser version) values to Extent report, without hard code.
Extent.properties
systeminfo.os=Windows
I want it should change based on the system.
U can access the static ExtentReport instance from ExtentService.getInstance() in a junit or testng before method in the runner. Then use extentobj.setSystemInfo(key, value) method.
Hi Mounish,
I added a @beforemethod and passing the ExtentService.getInstance().setSystemInfo(String k, String v) values.
Eg:
ExtentService.getInstance().setSystemInfo(“Platform”,System.getProperty(“os.name”));
Still, I’m not getting the correct value on the report. Can you share the implementation sample.
U mean the value is getting overwritten? Do u have the same ‘Platform’ key in the properties file?
Mounish,
This the entry I commented on my extent.properties file.
#systeminfo.os=Windows
This is the entry I put it on my common step definition class
@BeforeMethod
public void printSystemInfo(){
ExtentService.getInstance().setSystemInfo(“Organization”,”Test Office”);
ExtentService.getInstance().setSystemInfo(“Platform”,System.getProperty(“os.name”));
ExtentService.getInstance().setSystemInfo(“Platform”,System.getProperty(“os.version”));
ExtentService.getInstance().setSystemInfo(“Architecture”,System.getProperty(“os.arch”));
ExtentService.getInstance().setSystemInfo(“Organization”,System.getProperty(“java.version”));
}
Any missing links between the extent services. Guide me on this.
I had tried it sometime back by placing the code, similar to what you have above, inside the @BeforeTest method in the runner. Let me know if this works. Thx.
It working fine after it moves the @beforetest code into the test runner. Is any way to capture the browser version.
Note: We have different agents with a different configuration, therefore manage the driver through the webdriver manager.
I think the Capabilities object from selenium provides the information. U could access this in the @aftertest method and add it to ExtentService.
Hello, the plugin for PDF reports is very helpful, but I have a question, when I run in my local everything looks good, but If a run it with Bamboo the PDF report is not getting the fonts and I get warnings in the console, do you know how can I fix that?
build 06-Jan-2021 15:59:40 WARN [FileSystemFontProvider.java:582][06 Jan 2021 15:59:36] – New fonts found, font cache will be re-built
build 06-Jan-2021 15:59:40 WARN [FileSystemFontProvider.java:335][06 Jan 2021 15:59:36] – Building on-disk font cache, this may take a while
build 06-Jan-2021 15:59:40 WARN [FileSystemFontProvider.java:338][06 Jan 2021 15:59:37] – Finished building on-disk font cache, found 6 fonts
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Times-Roman
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Times-Bold
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Times-Italic
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Times-BoldItalic
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Helvetica
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Helvetica-Bold
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Helvetica-Oblique
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Helvetica-BoldOblique
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Courier
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Courier-Bold
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Courier-Oblique
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Courier-BoldOblique
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font Symbol
build 06-Jan-2021 15:59:40 WARN [PDType1Font.java:161][06 Jan 2021 15:59:37] – Using fallback font LiberationSans for base font ZapfDingbats
Seems pdfbox tries to load these 14 fonts by default – https://github.com/apache/pdfbox/blob/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java. My guess is that these are not available in the Bamboo environment. Not sure if there is some setting in pdfbox that can modify this behavior. Change the logging level would be the easiest option. U could also try downloading and adding these fonts to the machine. Sorry cannot be of more help. U could try posting this on stackoverflow, the pdfbox maintainers are pretty quick to respond.
Dec 28, 2020 6:38:34 PM tech.grasshopper.pdf.PDFCucumberReport collectReportConfiguration
INFO: PDF report configuration not found. Using default settings.
Dec 28, 2020 6:38:34 PM tech.grasshopper.pdf.PDFCucumberReport createReport
SEVERE: An exception occurred
java.io.IOException: The TrueType font null does not contain a ‘cmap’ table
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapImpl(TrueTypeFont.java:553)
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:533)
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:519)
at org.apache.fontbox.ttf.TTFSubsetter.(TTFSubsetter.java:90)
at org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.subset(TrueTypeEmbedder.java:346)
at org.apache.pdfbox.pdmodel.font.PDType0Font.subset(PDType0Font.java:256)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1349)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1328)
at tech.grasshopper.pdf.PDFCucumberReport.createReport(PDFCucumberReport.java:111)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.flush(ExtentPDFCucumberReporter.java:66)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.access$1(ExtentPDFCucumberReporter.java:57)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:42)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:1)
at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310)
at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226)
at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83)
at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85)
at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:284)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.finishReport(ExtentCucumberAdapter.java:296)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$6(ExtentCucumberAdapter.java:295)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:132)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:1)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:93)
at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:74)
at io.cucumber.testng.TestNGCucumberRunner.finish(TestNGCucumberRunner.java:126)
at com.arb.aut.Base.AbstractTestNG.tearDownClass(AbstractTestNG.java:63)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:61)
at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:366)
at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:320)
at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:217)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:130)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:28)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:425)
at org.testng.internal.thread.ThreadUtil.lambda$execute$0(ThreadUtil.java:66)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
Dec 28, 2020 6:38:34 PM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
tech.grasshopper.pdf.exception.PdfReportException: java.io.IOException: The TrueType font null does not contain a ‘cmap’ table
at tech.grasshopper.pdf.PDFCucumberReport.createReport(PDFCucumberReport.java:115)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.flush(ExtentPDFCucumberReporter.java:66)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.access$1(ExtentPDFCucumberReporter.java:57)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:42)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:1)
at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310)
at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226)
at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83)
at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85)
at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:284)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.finishReport(ExtentCucumberAdapter.java:296)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$6(ExtentCucumberAdapter.java:295)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:132)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:1)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:93)
at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:74)
at io.cucumber.testng.TestNGCucumberRunner.finish(TestNGCucumberRunner.java:126)
at com.arb.aut.Base.AbstractTestNG.tearDownClass(AbstractTestNG.java:63)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:61)
at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:366)
at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:320)
at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:217)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:130)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:28)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:425)
at org.testng.internal.thread.ThreadUtil.lambda$execute$0(ThreadUtil.java:66)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.io.IOException: The TrueType font null does not contain a ‘cmap’ table
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapImpl(TrueTypeFont.java:553)
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:533)
at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:519)
at org.apache.fontbox.ttf.TTFSubsetter.(TTFSubsetter.java:90)
at org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.subset(TrueTypeEmbedder.java:346)
at org.apache.pdfbox.pdmodel.font.PDType0Font.subset(PDType0Font.java:256)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1349)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1328)
at tech.grasshopper.pdf.PDFCucumberReport.createReport(PDFCucumberReport.java:111)
… 40 more
Please help
Are u getting this with multiple runners?
Hello Mounish,
I get the same error mentioned above with single runner.
Could you please help?
Jan 12, 2021 9:09:03 PM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(Unknown Source)
at java.util.Collections.min(Unknown Source)
at tech.grasshopper.pdf.data.ReportData.populateSummaryChapterData(ReportData.java:69)
at tech.grasshopper.pdf.data.ReportData.populateChapterData(ReportData.java:29)
at tech.grasshopper.pdf.PDFCucumberReport.(PDFCucumberReport.java:57)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.flush(ExtentPDFCucumberReporter.java:65)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.access$1(ExtentPDFCucumberReporter.java:57)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:42)
at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:1)
at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310)
at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226)
at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83)
at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85)
at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:284)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.finishReport(ExtentCucumberAdapter.java:296)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$6(ExtentCucumberAdapter.java:295)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:132)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:1)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:93)
at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:74)
at io.cucumber.junit.Cucumber$RunCucumber.evaluate(Cucumber.java:236)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Which version of cucumber and the adapter? Are any features\scenarios executed? Is the Spark report generated?
Hello Mounish,
I am getting the same error too.
Jun 01, 2021 7:35:23 PM tech.grasshopper.pdf.PDFCucumberReport collectReportConfiguration
INFO: PDF report configuration YAML file not found. Using default settings.
Jun 01, 2021 7:35:23 PM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(ArrayList.java:862)
at java.util.Collections.min(Collections.java:596)
I am using
extentreports-cucumber6-adapter 2.6.0
Single Runner file with
tags = “@smoke and @Regression”,
Please advise.
I am unable replicate this. Plz share ur code as I mentioned before. Thanks.
Hello Mounish made my repository as public
Removed the password…for urls
https://github.com/vspune/BDD-Parallel-Run.git
This works >
tags = “@Smoke”, – Ok at feature level
tags = “@Login and @Home” – error
tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(ArrayList.java:862)
at java.util.Collections.min(Collections.java:596)
Thanks
Vaibhav
Thanks. This is a bug, I forgot to call the method which checks the data. Will be creating a new release in a couple of days and will add this fix.
This only happens when there are no feature executed. The ‘login and home’ tag filter does not match any feature in the files.
U should look at moving the test code u have in src\main\java to src\test\java. Also u no longer need the repository tag in POM. And also u can remove the ralph and extentreport dependency.
The ‘login and home’ tag filter does not match any feature in the files.
U should look at moving the test code u have in src\main\java to src\test\java. Also u no longer need the repository tag in POM. And also u can remove the ralph and extentreport dependency.
Thank You Sir for Reply…may be the files i changed but did not rename while addressing
How can i get a new alert for the release ?
Also can u please share the git location along with POM as u said to remove dependencies.
Thanks
Vaibhav
I will send in a pull request to your repository with the changed POM.
Sir any updates.
New version is available in maven
Hello Mounish Sir,
I am not able to proceed as I get below now
log4j:WARN No appenders could be found for logger (freemarker.cache).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Jun 20, 2021 11:30:10 AM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
tech.grasshopper.pdf.exception.PdfReportException: No features present in test execution.
at tech.grasshopper.pdf.data.ReportData.populateCounts(ReportData.java:58)
at tech.grasshopper.pdf.data.ReportData.populateSectionData(ReportData.java:50)
at tech.grasshopper.pdf.PDFCucumberReport.(PDFCucumberReport.java:51)
Cases:-
1) Moved all folder from src/main/java (except driverfactory) to src/test/java
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Jun 20, 2021 11:30:10 AM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
tech.grasshopper.pdf.exception.PdfReportException: No features present in test execution.
2) moved under scr/main/java execpt runner in src/test/java
Jun 20, 2021 11:24:01 AM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
tech.grasshopper.pdf.exception.PdfReportException: No features present in test execution.
3) When I tried with 1 Tag and my older structure that is as below it runs.
src/test/java > Runnerfile ,stepdef
src/main/java > pages
src/test/resources > feature file
Please advise as what shd me the folder structure as I confused.
Have kept visibility to public for reviewing https://github.com/vspune/BDD-Parallel-Run.git
Anything to chnage in POM?
Thank You.
The tag filter “@Smoke1 and @Home” does not match any features so the PDF report is not generated. Refer to cucumber documentation on how tag filters work or refer to this https://ghauto.tech/557/.
Have sent a PR to your repository with the changes.
Hello Mounish Sir,
Did go through the link u shared for tags but cannot proceed for below
{“@Tag1″,”@Tag2”} — Type mismatch: cannot convert from String[] to String
{“@Tag1″,”@Tag2”} — Type mismatch: cannot convert from String[] to String
{“@Tag1,@Tag2”} — Type mismatch: cannot convert from String[] to String
Single tag runs.
Also in the same channel I read other team members faced the same issue not sure what was the end solution.
I already have the ‘com.github.ralfstuckert.pdfbox-layout’ in POM too but
Please advise Sir.
Thank You.
In latest cucumber versions u need to use the keywords “and”, “or” instead of the old syntax.
Sir , did run as per ur advise.
I have 2 features files and at feature level tag is defined @Smoke1,@Smoke2 using the same structure u shared.
Observation:-
1) “@Smoke1 or @Smoke2” – Observation – It ran both the features, it should have ran 1 only
2) “@Smoke1 and @Smoke2” – Fails
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Jun 22, 2021 2:53:33 PM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush
SEVERE: An exception occurred
tech.grasshopper.pdf.exception.PdfReportException: No features present in test execution.
at tech.grasshopper.pdf.data.ReportData.populateCounts(ReportData.java:58)
at tech.grasshopper.pdf.data.ReportData.populateSectionData(ReportData.java:50)
at tech.grasshopper.pdf.PDFCucumberReport.(PDFCucumberReport.java:51)
3) “@Smoke1 or ~@Smoke2”, – Pass 1 feature file was executed
I am using command mvn test -Dbrowser=chrome to run.
Thanks VS
Your understanding of how tags work in cucumber is not correct. When you use “@Smoke1 or @Smoke2”, then cucumber will match any feature\scenario which have either @Smoke1 or @Smoke2 tag. When you use “@Smoke1 and @Smoke2”, then cucumber will only match feature\scenario which have both @Smoke1 and @Smoke2 tags together.
Thank You for Mentoring, Yes my understanding was wrong.
Now I get it.
Thanks VS.
Hello,
I have created multiple runners and each runner I am executing it in TestNG.xml with different parameters. Its a appium project and I am diving the load on devices based on ruuner file.
The class name tag is a Cucumber TESTNG runner file location and all runners have cucumber adapter 6 plugin information.
When I am running this TestNG.xml from POM, I am able to generate a spark.html report properly, but the PDF report is getting corrupted because multiple runner file overriding the same pdf file.
Need your urgent support in fixing this issue, please.
And Also, how can I flush the report at a regular interval because network interference in the middle destroy the complete report generation.
The PDF report with the current code will not work with multiple runners. I will add it to the article. Even though Spark generates a final report, it is run multiple times (equal to the number of runners), which can be pretty wasteful. U can try with a maven plugin which will run the reports in the post-integration phase of the Maven cycle. Refer to this – https://ghauto.tech/2114/
Hi Mounish,
This plugin is very useful and publishes good Html reports.
I was facing an issue in printing this spark.html report to Email Body as this report consists CSS/Links/Graphics data.
Do we have any property to configure light weight/High level Html summary report using this plugin?? Please help.
Thanks,
Shankar
Hi.. Not sure I understand this part – “printing this spark.html report to Email Body”. Have u tried zipping the relevant files? Do clarify.
To only output the dashboard part of the report, refer to the “Spark View Order” section. U can also have a look at the “PDF report”. U can configure it to produce just the dashboard. Only the pdf needs to be emailed.
It is an Auto triggered Email through Jenkins once test is done and i made the “spark.html” report inside html body – default content of the email. Email displaying plain text instead of html Dashboard.
Zipped and attached the report in email through Jenkins done successfully.
But i need to display Highlevel summary in email Content through Jenkins, and that shouldn’t have the css/graphics data.
In Continuation to below…
I tried with PDF but it is corrupting, no content displayed.
It is an auto triggered email through Jenkins triggered once test is done and i made “spark.html” report inside html body of the Email default content, but it is displayed plain text instead of Dashboard.
But i need to display High level report in Email Body through Jenkins and that shouldn’t have CSS/Graphics content.
I tried with PDF but it is corrupting, no content displayed.
Please help the steps to get high level report table.
The Spark report will not generate a plain ‘no frills’ summary without the CSS\JS files. What u can try is to use the Summary plugin which is available in the cucumber code base. I think the output of this report can be directed to a file, which can be used for the email summary.
DO u have any exception from the PDF report? It would be very helpful. Thanks
Thanks Mounish for you reply!
As you said I tried searching for Cucumber Summary Report plugin, couldn’t get proper information. Can you please give basic idea in configuring Cucumber-Summary report.
Regarding pdf Generation:- Not able to generate pdf using below configuration, Please suggest if anything is wrong.
POM.xml:-
org.apache.maven.plugins
maven-surefire-plugin
3.0.0-M1
-Xmx1024m -XX:MaxPermSize=256m
-Dfile.encoding=UTF-8
methods
10
false
io.cucumber
cucumber-java
5.6.0
test
io.cucumber
cucumber-junit
5.6.0
test
com.aventstack
extentreports
4.1.5
tech.grasshopper
extentreports-cucumber5-adapter
1.1.0
tech.grasshopper
extent-pdf-report
1.5.0
extent.properties file configuration:-
extent.reporter.spark.start=true
extent.reporter.pdf.start=true
extent.reporter.spark.out=target/test-output/SparkReport/Spark.html
extent.reporter.pdf.out=target/test-output/PdfReport/ExtentPdf.pdf
systeminfo.os=Windows
systeminfo.version=10-pro
@CucumberOptions – “com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:”
Please help.
As u r using cucumber 5, please refer to this sample project https://github.com/grasshopper7/cuke5-extent-adapter-report for how to setup project for reports
Hi Mounish,
Screenshots of each steps are no more displayed after upgrade to spark reports is their anyway we can view out screenshots in reports like we use to have in deprecated version ( htmlreport )
Updated Dependeny used
tech.grasshopper
extentreports-cucumber6-adapter
2.5.0
test
To add Screenshot on desired step I am using Below code
ExtentCucumberAdapter.addTestStepScreenCaptureFromPath(Util.screencapture());
@Then(“^he cancels active filters if any$”)
public void he_cancels_active_filers_if_any() throws Throwable {
WebDriverWait Loader = new WebDriverWait(driver, 25);
Loader.until(ExpectedConditions.invisibilityOf(lp.pageLoad1()));
Loader.until(ExpectedConditions.invisibilityOf(lp.pageLoad2()));
ExtentCucumberAdapter.addTestStepScreenCaptureFromPath(Util.screencapture());
util.cancelfilter();
}
Method to capture Screenshot
public static String screencapture() {
TakesScreenshot ts = (TakesScreenshot) driver;
File src = ts.getScreenshotAs(OutputType.FILE);
String encodedBase64 = null;
FileInputStream fileInputStreamReader = null;
try {
fileInputStreamReader = new FileInputStream(src);
byte[] bytes = new byte[(int) src.length()];
fileInputStreamReader.read(bytes);
encodedBase64 = new String(Base64.encodeBase64(bytes));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return “data:image/jpeg;base64,” + encodedBase64;
}
Properties File
extent.reporter.avent.start=false
extent.reporter.bdd.start=false
extent.reporter.cards.start=false
extent.reporter.email.start=false
extent.reporter.html.start=true
extent.reporter.klov.start=false
extent.reporter.logger.start=false
extent.reporter.tabular.start=false
extent.reporter.spark.start=true
extent.reporter.avent.config=
extent.reporter.bdd.config=
extent.reporter.cards.config=
extent.reporter.email.config=
extent.reporter.html.config=ReportConfig/ExtentConfig.xml
extent.reporter.klov.config=
extent.reporter.logger.config=ReportConfig/LoggerReport/LoggerReport.xml
extent.reporter.tabular.config=
extent.reporter.avent.out=
extent.reporter.bdd.out=
extent.reporter.cards.out=
extent.reporter.email.out=
extent.reporter.html.out=target/test-output/HtmlReport/ExtentHtml.html
extent.reporter.logger.out=target/test-output/LoggerReport/
extent.reporter.tabular.out=target/test-output/table/
extent.reporter.spark.out=target/test-output/SparkReport/Spark.html
extent.reporter.spark.out=target/test-output/SparkReport/
screenshot.dir=target/test-output/
screenshot.rel.path=../
There is new feature in 2.6.0, planning to release in a couple of days, which supports base64 image embedding with a configuration setting. It is available in snapshot release. U will not have to perform any base64 processing in your test code. Refer to this – https://github.com/grasshopper7/extentreports-cucumber6-adapter/issues/11
Version 2.6.0 is released in Maven with Base64 image support. Refer to the documentation for more details
Hi Mounish,
When I tried to execute the scenario outline with more than 2 data, I’m getting an error to attach the screenshot.
“Scenario Outline: Open Google Search # src/test/resources/Feature/GoogleTest.feature:15
org.apache.commons.io.IOExceptionList: 1 exceptions: [java.io.IOException: Unable to delete file: C:\Users\tester\Documents\A
utomation\Demo\target\Screenshots\embedded10.png]”
Code : @AfterStep()
public void attach_screenshot() throws Throwable {
// if(scenario.isFailed()){
TakesScreenshot ts=(TakesScreenshot)driver;
byte[] screenshot=ts.getScreenshotAs(OutputType.BYTES);
scenario.attach(screenshot,”image/png”,””);
// }
}
@Before
public void beforMethodSetUp(Scenario scenario) throws Throwable {
this.scenario = scenario;
if ((new File(screenshotdir)).exists())
FileUtils.cleanDirectory(new File(screenshotdir));
}
Let me know the changes.
What is the reason for deleting the screenshot images folder?
Hello. Is there a way to change gherkin dialect?
Changing the language option in the feature file is not working in the report? Can u mention some more details? thx
Hello. Dialect in the feature file is working fine. In fact my tests pass. However as soon as I added above reporting tool I receive following error:
java.lang.ClassNotFoundException: com.aventstack.extentreports.gherkin.model.Zakładając,Że
My guess is that I missed some of configurations to change dialect language on ExtentReports level.
Here’s my files:
Runner (I use TestNG)
package runner;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
@CucumberOptions(
features = “src/test/resources/features”,
glue = “steps”,
plugin = {“com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:”}
)
public class RunCucumber extends AbstractTestNGCucumberTests {}
pom.xml
4.0.0
pl.com.britenet
tuw-automation-tests
1.0-SNAPSHOT
1.8
6.8.1
3.141.59
4.12
1.7.25
3.1.1
3.1.1
1.0.6
1.16.20
UTF-8
${project.basedir}/src/main/java/
${project.basedir}/src/test/java/
org.apache.maven.plugins
maven-compiler-plugin
3.8.1
${java.version}
${java.version}
${java.version}
${encoding}
org.apache.maven.plugins
maven-surefire-plugin
2.18.1
usedefaultlisteners
false
false
src/test/resources/runner/testng.xml
true
io.cucumber
cucumber-java
${cucumber.version}
io.cucumber
cucumber-core
${cucumber.version}
io.cucumber
cucumber-testng
${cucumber.version}
io.cucumber
cucumber-junit
${cucumber.version}
io.cucumber
cucumber-picocontainer
${cucumber.version}
org.slf4j
slf4j-api
${slf4j.version}
org.seleniumhq.selenium
selenium-java
${selenium.version}
junit
junit
${junit.version}
test
tech.grasshopper
extentreports-cucumber6-adapter
2.4.0
test
org.projectlombok
lombok
${lombok.version}
extent.properties
extent.reporter.spark.start=true
extent.reporter.spark.out=target/test-report/report.html
extent.reporter.spark.config=src/test/resources/extent-config.xml
extent-config.xml
standard
UTF-8
http
Automation Tests Report
Automation Tests Report
top
There is an issue in the gherkin languages json file in extent report 5.0.1 version. U can check in the jar file gherkin-languages.json
“given”: [
“* “,
” ładając “,
“Mając “,
“Zakładając, że ”
]
In the version 5.0.4, it is fixed.
“given”: [
“* “,
“Zakładając “,
“Mając “,
“Zakładając, że ”
]
In your project can u explicitly import extentreport with latest version 5.0.5 or even 5.0.4 and try it. I think it could be the solution. If it works I will bump up the extentreports version that the adapter uses. Thanks.
Interesting because my gherkin-languages.json version 5.0.1 looks fine. However I imported extentreport 5.0.5 and unfortunately the error persists.
Can u mention the complete stack trace?
SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
1605773974585 geckodriver INFO Listening on 127.0.0.1:14813
1605773975226 mozrunner::runner INFO Running command: “C:\\Program Files\\Mozilla Firefox\\firefox.exe” “–marionette” “-foreground” “-no-remote” “-profile” “C:\\Users\\BRITENET\\AppData\\Local\\Temp\\rust_mozprofiletZ1NqJ”
Can’t find symbol ‘eglSwapBuffersWithDamageEXT’.
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can’t find profile directory.
console.warn: SearchSettings: “get: No settings file exists, new profile?” (new Error(“”, “(unknown module)”))
1605773977242 Marionette INFO Listening on port 53395
1605773977355 Marionette WARN TLS certificate errors will be ignored for this session
lis 19, 2020 9:19:37 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
JavaScript error: resource://gre/modules/URIFixup.jsm, line 271: NS_ERROR_FAILURE: Should pass a non-null uri
java.lang.ClassNotFoundException: com.aventstack.extentreports.gherkin.model.Zakładając,Że
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at com.aventstack.extentreports.GherkinKeyword.(GherkinKeyword.java:80)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.createTestStep(ExtentCucumberAdapter.java:409)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.handleTestStepStarted(ExtentCucumberAdapter.java:168)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$2(ExtentCucumberAdapter.java:156)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$4.receive(ExtentCucumberAdapter.java:103)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$4.receive(ExtentCucumberAdapter.java:1)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.SynchronizedEventBus.send(SynchronizedEventBus.java:47)
at io.cucumber.core.runtime.ThreadLocalRunnerSupplier$LocalEventBus.send(ThreadLocalRunnerSupplier.java:66)
at io.cucumber.core.runner.TestStep.emitTestStepStarted(TestStep.java:80)
at io.cucumber.core.runner.TestStep.run(TestStep.java:59)
at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:51)
at io.cucumber.core.runner.TestCase.run(TestCase.java:104)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
at io.cucumber.testng.TestNGCucumberRunner.lambda$runScenario$0(TestNGCucumberRunner.java:116)
at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:117)
at io.cucumber.testng.TestNGCucumberRunner.runScenario(TestNGCucumberRunner.java:113)
at io.cucumber.testng.AbstractTestNGCucumberTests.runScenario(AbstractTestNGCucumberTests.java:31)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.runSuites(TestNG.java:1069)
at org.testng.TestNG.run(TestNG.java:1037)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
java.lang.ClassNotFoundException: com.aventstack.extentreports.gherkin.model.Kiedy
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at com.aventstack.extentreports.GherkinKeyword.(GherkinKeyword.java:80)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.createTestStep(ExtentCucumberAdapter.java:409)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.handleTestStepStarted(ExtentCucumberAdapter.java:168)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$2(ExtentCucumberAdapter.java:156)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$4.receive(ExtentCucumberAdapter.java:103)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$4.receive(ExtentCucumberAdapter.java:1)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.SynchronizedEventBus.send(SynchronizedEventBus.java:47)
at io.cucumber.core.runtime.ThreadLocalRunnerSupplier$LocalEventBus.send(ThreadLocalRunnerSupplier.java:66)
at io.cucumber.core.runner.TestStep.emitTestStepStarted(TestStep.java:80)
at io.cucumber.core.runner.TestStep.run(TestStep.java:59)
at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:51)
at io.cucumber.core.runner.TestCase.run(TestCase.java:104)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
at io.cucumber.testng.TestNGCucumberRunner.lambda$runScenario$0(TestNGCucumberRunner.java:116)
at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:117)
at io.cucumber.testng.TestNGCucumberRunner.runScenario(TestNGCucumberRunner.java:113)
at io.cucumber.testng.AbstractTestNGCucumberTests.runScenario(AbstractTestNGCucumberTests.java:31)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.runSuites(TestNG.java:1069)
at org.testng.TestNG.run(TestNG.java:1037)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
java.lang.ClassNotFoundException: com.aventstack.extentreports.gherkin.model.Oraz
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at com.aventstack.extentreports.GherkinKeyword.(GherkinKeyword.java:80)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.createTestStep(ExtentCucumberAdapter.java:409)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.handleTestStepStarted(ExtentCucumberAdapter.java:168)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$2(ExtentCucumberAdapter.java:156)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$4.receive(ExtentCucumberAdapter.java:103)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$4.receive(ExtentCucumberAdapter.java:1)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.SynchronizedEventBus.send(SynchronizedEventBus.java:47)
at io.cucumber.core.runtime.ThreadLocalRunnerSupplier$LocalEventBus.send(ThreadLocalRunnerSupplier.java:66)
at io.cucumber.core.runner.TestStep.emitTestStepStarted(TestStep.java:80)
at io.cucumber.core.runner.TestStep.run(TestStep.java:59)
at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:51)
at io.cucumber.core.runner.TestCase.run(TestCase.java:104)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
at io.cucumber.testng.TestNGCucumberRunner.lambda$runScenario$0(TestNGCucumberRunner.java:116)
at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:117)
at io.cucumber.testng.TestNGCucumberRunner.runScenario(TestNGCucumberRunner.java:113)
at io.cucumber.testng.AbstractTestNGCucumberTests.runScenario(AbstractTestNGCucumberTests.java:31)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.runSuites(TestNG.java:1069)
at org.testng.TestNG.run(TestNG.java:1037)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
java.lang.ClassNotFoundException: com.aventstack.extentreports.gherkin.model.Wtedy
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at com.aventstack.extentreports.GherkinKeyword.(GherkinKeyword.java:80)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.createTestStep(ExtentCucumberAdapter.java:409)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.handleTestStepStarted(ExtentCucumberAdapter.java:168)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$2(ExtentCucumberAdapter.java:156)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$4.receive(ExtentCucumberAdapter.java:103)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$4.receive(ExtentCucumberAdapter.java:1)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.SynchronizedEventBus.send(SynchronizedEventBus.java:47)
at io.cucumber.core.runtime.ThreadLocalRunnerSupplier$LocalEventBus.send(ThreadLocalRunnerSupplier.java:66)
at io.cucumber.core.runner.TestStep.emitTestStepStarted(TestStep.java:80)
at io.cucumber.core.runner.TestStep.run(TestStep.java:59)
at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:51)
at io.cucumber.core.runner.TestCase.run(TestCase.java:104)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
at io.cucumber.testng.TestNGCucumberRunner.lambda$runScenario$0(TestNGCucumberRunner.java:116)
at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:117)
at io.cucumber.testng.TestNGCucumberRunner.runScenario(TestNGCucumberRunner.java:113)
at io.cucumber.testng.AbstractTestNGCucumberTests.runScenario(AbstractTestNGCucumberTests.java:31)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.runSuites(TestNG.java:1069)
at org.testng.TestNG.run(TestNG.java:1037)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
1605773980408 Marionette INFO Stopped listening on port 53395
###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
###!!! [Child][MessageChannel::SendAndWait] Error: Channel error: cannot send/recv
This exception is from the extentreports source. There is a difference in the gherkin keywords supported, basically the extent json is old. Have created an issue in extent repo – https://github.com/extent-framework/extentreports-java/issues/271. The “Przykład” word for scenario is missing in extent json. Cucumber – https://github.com/cucumber/cucumber/blob/master/gherkin/gherkin-languages.json#L2567 and Extent – https://github.com/extent-framework/extentreports-java/blob/master/src/main/resources/com/aventstack/extentreports/gherkin/gherkin-languages.json.
Can u mention the keywords u are using for feature, scenario, given , when, then? Will create a test to dig this deeper. THx
Here’s the list of keywords I use:
Szablon scenariusza: (Scenario Outline:)
Zakładając, że (Given)
Kiedy (When)
Oraz (And)
Wtedy (Then)
Przykłady: (Examples:)
Thank you
There is a bug in the adapter code. It is not taking into account the dialect at all. Will look at ways to fix it.
I have updated the code for dialect support in version 2.5.0. Maven should sync it soon. Do try and let me know if it works. thx.
Yes, it works now. Thank you for your help!
Tried that . Version I am using is 6
extentreports-cucumber6-adapter
I am using version 6. Tried that too
My pom xml looks like below
org.apache.maven.plugins
maven-assembly-plugin
2.2.1
true
/
runner.TestRunner
true
test-output/HtmlReport/ExtendedReport.html
true
test-output/SparkReport/SparkExt.html
org.apache.maven.plugins
maven-surefire-plugin
3.0.0-M4
methods
1
false
<!– true lib/ –>
runner.TestRunner
true
test-output/HtmlReport/Spark.html
true
test-output/SparkReport/Spark.html
tech.grasshopper
extentreports-cucumber6-adapter
1.2.0
<!– io.cucumber cucumber-java
io.cucumber cucumber-core
–>
I am trying to run the Cucumber test cases as a jar file.
I am able to run the tests. But I am not able to generate the html reports.
The runner class I created for this is as follows
package runner;
import java.util.stream.Stream;
public final class TestRunner {
private static String[] defaultOptions = { “–glue”, “stepdefs”,
“–plugin”, “pretty”,
“–plugin”, “json:cucumber.json”,
“–plugin”, “html:target/HtmlReports.html”,
“–plugin”, “com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:”,
“–tags”, “@DigitalStable”
};
public static void main(String[] args) {
Stream cucumberOptions = Stream.concat(Stream.of(defaultOptions), Stream.of(args));
// cucumber.api.cli.Main.main(cucumberOptions.toArray(String[]::new));
io.cucumber.core.cli.Main.main(cucumberOptions.toArray(String[]::new));
}
}// TestRunner
It is not reading extent.properties file itself.
Which version are u using? Yeah seems to be an issue regarding jar file reading extent.properties. To get around this u can pass the key value pairs as system properties. Refer to the ‘Report Activation’ section.
Tried that . Version I am using is 6
extentreports-cucumber6-adapter
I am running the test in command line as given below
java -jar myapp.jar classpath:resources
Will have a look. Did setting the properties through system work?
No it has not.
Would be very helpful if you can give step by step instruction
will look at this tomorrow, as have never tried it from a jar file. Though u could also set the properties required using System.setProperty() in the java main class file. For spark report set the ‘extent.reporter.spark.start’ and ‘extent.reporter.spark.out’ options.
Were you able to look on this
My apologies but it will not be possible today as I am swamped. U can try this easily by just adding the below lines in the main method. System.setProperty(“extent.reporter.spark.start”, true) and possibly also this System.setProperty(“extent.reporter.spark.out”, “report directory value”)
Great news. Spark is working. But not html or avent or bdd
which version of adapter are u using? html, avent etc reports are all deprecated in adapter version after 2.0.0 as extentreport version 5 is being used.
I was using 1.1.0.
I changed to 2.3.0
In the 2.3.0 u can generate spark, json, klov and pdf report only. Rest are deprecated
What about 1.1.0
u would need to add similar system properties in the code. extent.reporter.html.start etc
Hi I am still looking for base64 snapshots as i need to email the reports generated,
I have seen the issue but there are no updates since last 2 m,onths
https://github.com/grasshopper7/extentreports-cucumber6-adapter/issues/11
Can we know when this feature be enabled?
versions used
extentreports-cucumber6-adapter:1.0.0
cucumberVersion:6.1.1
Got no fixed time frame, maybe in a couple of weeks.
I have added base64 support for images. – https://oss.sonatype.org/content/repositories/snapshots/tech/grasshopper/extentreports-cucumber6-adapter/
U will need to add below dependency to project POM
dependency
groupId tech.grasshopper /groupId>
artifactId extentreports-cucumber6-adapter /artifactId
version 2.6.0-SNAPSHOT /version
/dependency
Set the below property in extent.properties
extent.reporter.spark.base64imagesrc=true
U will need to enable snapshot release in POM – https://stackoverflow.com/questions/16286055/how-to-get-snapshot-from-sonatype/16286460#16286460
Let me send your feedback, then I will proceed to release this as a full upgrade. My concern is that the spark report size is going to be an issue
Hey Mounish! Sorry to bother you again.
I’m able to generate the sparks and JSON report but klov report shows nothing under projects. Similar to this issue,
https://github.com/extent-framework/klov/issues/69
Are u getting any errors on the console? If not can u run the adpater from the git code and see if any exceptions are thrown.
I do not have a klov reporter setup currently to check this. Will look at setting it up at the earliest
Hi, I was able to setup mongodb and klov after much effort. There is a bug in the adapter code which is failing the initialization. Will fix and release a new version tomorrow. The adapter is now creating the document data in the mongodb, did a direct check in the db. Got some docker issues so unable to communicate properly between klov server and mongodb.
i was able to setup the communication between klov and docker by using following compose file:
version: ‘2’
services:
klov:
image: anshooarora/klov:1.0.1
container_name: klov
environment:
– SPRING_DATA_MONGODB_URI=mongodb://host.docker.internal:27017
ports:
– 8443:80
I’ve also tried by pulling the klov.jar and using application.properties. In both case, communication between klov and mongodb was successful.
I’ll try the latest update. Thanks a lot
Have uploaded the new jar – 2.4.0 in nexus. Should be available in maven pretty soon. Can u try it out and also a scenario with screenshot? I am unable to debug the reason for tomcat on docker not able to connect to mongodb to generate the report on my setup.
Hi, I tried the latest jar, still the same issue (no reports listed on klov dashboard). Also, there is no error on the console.
I’m using mongodb 4.4.1 and klov version 1.0.1.
klov.properties looks like this:
klov.project.name=Default
klov.report.name=Build
mongodb.host=localhost
mongodb.port=27017
klov.host=localhost
klov.port=8443
I’m trying it with screenshots, spark reports are absolutely fine.
U get an error in the tomcat klov console. The klov docker container is not able to create a socket to connect to mongodb. This does not seem to be a cucumber adapter issue. I will try to check over the weekend how this can be fixed, but my docker and networking skills are pretty limited. R u able to generate data in the mongodb?
there’s no data in mongodb for klov but i think i’m able to make a connection between klov(in docker) and mongodb(windows). Here’s the log snapshot:
com.mongodb.diagnostics.logging.SLF4JLogger: Monitor thread successfully connected to server with description ServerDescription{address=host.docker.internal:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 4, 1]}, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=6083500}
I don’t have much idea about docker and mongodb…just started working on it.
This log is from the startup of the klov tomcat docker container. The socket timeout error comes when u try to access the klov application homepage from the browser. What version of windows?
windows 10 and there is no socket error connection. The last log entry is:
com.mongodb.diagnostics.logging.SLF4JLogger: Opened connection [connectionId{localValue:5, serverValue:94}] to host.docker.internal:27017
and then there are no more log entries.
Let me know if you need complete logs.
Hi Mounish,
Any updates? Can we connect over skype to figure out the issue?
I tried it again on an old windows 8.1 machine and the test run data is updated in mongodb. But getting a socket error when klov tomcat server tried to access mongodb. Basically same as before. I am unable to provide a way forward on this. Will update the original issue in github with the findings. The klov report developer would be the one to debug this.
Can u send me the logs from the klov tomcat console. Mark the line which ends the server startup, then try to access the klov server from browser. Want to see if you are getting some other info.
Starting klov … done Attaching to klov
klov | _ _
klov | | |__ | | ___ _ _
klov | | / / | | / . \ | | |
klov | |_\_\ |_| \___/ |__/
klov |
klov | 2020-11-10 09:16:16,537 INFO [main] org.springframework.boot.StartupInfoLogger: Starting KlovApplication v1.0.1.RELEASE on df24e63223b2 with PID 1 (/klov.jar started by root in /)
klov | 2020-11-10 09:16:16,540 INFO [main] org.springframework.boot.SpringApplication: No active profile set, falling back to default profiles: default
klov | 2020-11-10 09:16:17,363 INFO [main] org.springframework.data.repository.config.RepositoryConfigurationDelegate: Bootstrapping Spring Data MongoDB repositories in DEFAULT mode.
klov | 2020-11-10 09:16:17,484 INFO [main] org.springframework.data.repository.config.RepositoryConfigurationDelegate: Finished Spring Data repository scanning in 113ms. Found 10 MongoDB repository interfaces.
klov | 2020-11-10 09:16:18,219 INFO [main] org.springframework.boot.web.embedded.tomcat.TomcatWebServer: Tomcat initialized with port(s): 80 (http)
klov | 2020-11-10 09:16:18,239 INFO [main] org.apache.juli.logging.DirectJDKLog: Initializing ProtocolHandler [“http-nio-80”]
klov | 2020-11-10 09:16:18,240 INFO [main] org.apache.juli.logging.DirectJDKLog: Starting service [Tomcat]
klov | 2020-11-10 09:16:18,241 INFO [main] org.apache.juli.logging.DirectJDKLog: Starting Servlet engine: [Apache Tomcat/9.0.34]
klov | 2020-11-10 09:16:18,408 INFO [main] org.apache.juli.logging.DirectJDKLog: Initializing Spring embedded WebApplicationContext
klov | 2020-11-10 09:16:18,409 INFO [main] org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext: Root WebApplicationContext: initialization completed in 1771 ms
klov | 2020-11-10 09:16:18,722 INFO [main] com.mongodb.diagnostics.logging.SLF4JLogger: Cluster created with settings {hosts=[host.docker.internal:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout=’30000 ms’, maxWaitQueueSize=500}
klov | 2020-11-10 09:16:18,794 INFO [cluster-ClusterId{value=’5faa5a62b6b2c01842df175d’, description=’null’}-host.docker.internal:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Opened connection [connectionId{localValue:1, serverValue:103}] to host.docker.internal:27017
klov | 2020-11-10 09:16:18,804 INFO [cluster-ClusterId{value=’5faa5a62b6b2c01842df175d’, description=’null’}-host.docker.internal:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Monitor thread successfully connected to server with description ServerDescription{address=host.docker.internal:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 4, 1]}, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=7338600}
klov | 2020-11-10 09:16:19,058 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘parentTest -> parentTest’
klov | 2020-11-10 09:16:19,059 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘parentTest -> nodes -> parentTest’
klov | 2020-11-10 09:16:19,059 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘nodes -> nodes’
klov | 2020-11-10 09:16:19,061 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘parentTest -> nodes -> history -> parentTest’
klov | 2020-11-10 09:16:19,062 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘nodes -> history -> nodes’
klov | 2020-11-10 09:16:19,063 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘history -> history’
klov | 2020-11-10 09:16:19,065 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘parentTest -> history -> parentTest’
klov | 2020-11-10 09:16:19,066 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘parentTest -> history -> nodes -> parentTest’
klov | 2020-11-10 09:16:19,067 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘nodes -> nodes’
klov | 2020-11-10 09:16:19,068 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘history -> nodes -> history’
klov | 2020-11-10 09:16:19,070 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘history -> history’
klov | 2020-11-10 09:16:19,070 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘parentTest -> parentTest’
klov | 2020-11-10 09:16:19,071 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘nodes -> parentTest -> nodes’
klov | 2020-11-10 09:16:19,072 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘parentTest -> history -> parentTest’
klov | 2020-11-10 09:16:19,073 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘nodes -> parentTest -> history -> nodes’
klov | 2020-11-10 09:16:19,074 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘history -> history’
klov | 2020-11-10 09:16:19,075 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘nodes -> nodes’
klov | 2020-11-10 09:16:19,077 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘parentTest -> parentTest’
klov | 2020-11-10 09:16:19,078 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘nodes -> history -> parentTest -> nodes’
klov | 2020-11-10 09:16:19,079 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘history -> parentTest -> history’
klov | 2020-11-10 09:16:19,081 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘nodes -> history -> nodes’
klov | 2020-11-10 09:16:19,083 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘history -> history’
klov | 2020-11-10 09:16:19,085 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘parentTest -> parentTest’
klov | 2020-11-10 09:16:19,087 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘parentTest -> nodes -> parentTest’
klov | 2020-11-10 09:16:19,088 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘nodes -> nodes’
klov | 2020-11-10 09:16:19,089 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘history -> parentTest -> nodes -> history’
klov | 2020-11-10 09:16:19,090 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘history -> parentTest -> history’
klov | 2020-11-10 09:16:19,092 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘parentTest -> parentTest’
klov | 2020-11-10 09:16:19,093 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘nodes -> parentTest -> nodes’
klov | 2020-11-10 09:16:19,094 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘history -> nodes -> parentTest -> history’
klov | 2020-11-10 09:16:19,095 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘nodes -> nodes’
klov | 2020-11-10 09:16:19,097 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘history -> nodes -> history’
klov | 2020-11-10 09:16:19,098 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$1: Found cycle for field ‘_id’ in type ‘Test’ for path ‘history -> history’
klov | 2020-11-10 09:16:19,109 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘parentTest’ in type ‘Test’ for path ‘parentTest -> parentTest’
klov | 2020-11-10 09:16:19,111 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘parentTest’ in type ‘Test’ for path ‘parentTest -> nodes -> parentTest’
klov | 2020-11-10 09:16:19,116 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘parentTest’ in type ‘Test’ for path ‘parentTest -> history -> parentTest’
klov | 2020-11-10 09:16:19,118 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘parentTest’ in type ‘Test’ for path ‘parentTest -> parentTest’
klov | 2020-11-10 09:16:19,119 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘parentTest’ in type ‘Test’ for path ‘nodes -> nodes’
klov | 2020-11-10 09:16:19,120 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘nodes’ in type ‘Test’ for path ‘nodes -> nodes’
klov | 2020-11-10 09:16:19,121 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘parentTest’ in type ‘Test’ for path ‘parentTest -> parentTest’
klov | 2020-11-10 09:16:19,122 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘nodes’ in type ‘Test’ for path ‘nodes -> history -> nodes’
klov | 2020-11-10 09:16:19,123 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘parentTest’ in type ‘Test’ for path ‘parentTest -> parentTest’
klov | 2020-11-10 09:16:19,124 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘parentTest’ in type ‘Test’ for path ‘parentTest -> parentTest’
klov | 2020-11-10 09:16:19,126 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘nodes’ in type ‘Test’ for path ‘nodes -> nodes’
klov | 2020-11-10 09:16:19,127 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘parentTest’ in type ‘Test’ for path ‘history -> history’
klov | 2020-11-10 09:16:19,129 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘parentTest’ in type ‘Test’ for path ‘history -> history’
klov | 2020-11-10 09:16:19,131 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘nodes’ in type ‘Test’ for path ‘history -> history’
klov | 2020-11-10 09:16:19,133 INFO [main] org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver: Found cycle for field ‘history’ in type ‘Test’ for path ‘history -> history’
klov | 2020-11-10 09:16:20,140 INFO [main] org.springframework.scheduling.concurrent.ExecutorConfigurationSupport: Initializing ExecutorService ‘applicationTaskExecutor’
klov | 2020-11-10 09:16:20,239 INFO [main] org.springframework.boot.autoconfigure.web.servlet.WelcomePageHandlerMapping: Adding welcome page template: index
klov | 2020-11-10 09:16:20,521 INFO [main] org.apache.juli.logging.DirectJDKLog: Starting ProtocolHandler [“http-nio-80″]
klov | 2020-11-10 09:16:20,548 INFO [main] org.springframework.boot.web.embedded.tomcat.TomcatWebServer: Tomcat started on port(s): 80 (http) with context path ”
klov | 2020-11-10 09:16:20,551 INFO [main] org.springframework.boot.StartupInfoLogger: Started KlovApplication in 4.587 seconds (JVM running for 5.154)
klov | 2020-11-10 09:17:20,662 INFO [http-nio-80-exec-1] org.apache.juli.logging.DirectJDKLog: Initializing Spring DispatcherServlet ‘dispatcherServlet’
klov | 2020-11-10 09:17:20,662 INFO [http-nio-80-exec-1] org.springframework.web.servlet.FrameworkServlet: Initializing Servlet ‘dispatcherServlet’
klov | 2020-11-10 09:17:20,680 INFO [http-nio-80-exec-1] org.springframework.web.servlet.FrameworkServlet: Completed initialization in 18 ms
klov | 2020-11-10 09:17:21,112 INFO [http-nio-80-exec-2] com.mongodb.diagnostics.logging.SLF4JLogger: Opened connection [connectionId{localValue:2, serverValue:104}] to host.docker.internal:27017
Hey Mounish,
Finally, I’m able to generate the KLOV reports… Thank you for all the help.
Let me know if you need any details.
How did u debug it? Kindly share the details.
As informed earlier, I was able to make a successful connection b/w MongoDB and klov.
1. Install MongoDB with the default setup and run it with administrative privileges.
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/
2. Install docker desktop for windows and use the following docker-compose file for setting it up on the localhost.
version: ‘2’
services:
klov:
image: anshooarora/klov:1.0.1
container_name: klov
environment:
– SPRING_DATA_MONGODB_URI=mongodb://host.docker.internal:27017
ports:
– 8443:80
Refer: https://github.com/extent-framework/klov
3. Run klov server on the browser, it would be accessible on http://localhost:8443
4. Now, in extent.properties enable klov reports:
extent.reporter.klov.start=true
extent.reporter.klov.config=src/test/resources/klov.properties
5. In klov.properties assign the following values:
mongodb.host=127.0.0.1
mongodb.port=27017
mongodb.uri=
klov.host=http://127.0.0.1
klov.port=8443
klov.project.name= Project name
klov.report.name=
and make sure you are using the latest extentreports-cucumber6-adapter i.e. 2.4.0.
😀
Hope this helps.
Thanks. I will try this out. What latest change u made that worked?
I updated “extent.reporter.klov.config” path and replaced “localhost” with “127.0.0.1” in klov.properties
Great… Now can u see the reports properly along with the screenshots?
Reports are fine…I can compare scenarios and tests across reports. However, there are no screenshots in klov reports but spark reports have screenshots in it.
Hey Mounish!
Unable to run the suite after packaging it in jar as the resources (config.xml) for reports are not accessed through classpath.
It throws error “no such file exists”.
Will have to check which part of the code is performing the access.
Please share the example of implementing klov reports
Currently I do not have a setup for klov reporter. Will definitely look at this as some other folks have also asked for this.
Is there a way to default your report to Dashboard screen when opened? I am using Extentreport cucumber 6 adapter 2.0.0 version.
Currently there is no way but I think extentreport v5 supports such options. Can u create an issue at – https://github.com/grasshopper7/extentreports-cucumber6-adapter/issues and i will look into it. thx
Hi Mounish,
When Running a Scenario Outline the count in the dashboard is incorrect . it displays double count to what scenario is executed also tags section shows same scenario title twice.
Please find Below link for report screenshots –
https://github.com/bughunter7/ExtentReportIssue
Dependency used –
tech.grasshopper
extentreports-cucumber6-adapter
1.2.0
test
Please let me the solution its urgent .also let me know if any more info required from my end awaiting for your response 🙂
Thanks.
ExtentReport considers the Scenario Outline as an additional test. This is the current behavior and would require a refactoring of extentreport code to change it for BDD reports. U can get a developer feedback on this by raising an issue in the extentreport github repo.
How to create report for running in Grid.. Means running in multibrowser on grid..
@Mounish continuation with previous one
please find below link for report and code location
Report: https://github.com/Takkaiscool/Cucumber-with-Parallel-Running/blob/master/test-output/Spark.html
Code: https://github.com/Takkaiscool/Cucumber-with-Parallel-Running.git
I am running on selenium grid in docker with 2 browsers (Chrome and Firefox) parallel.
Code contains 1 feature and 2 scenario
In report it is showing
2 separate feature and in 1 feature there is only 1 scenario and rest 3 in other scenario.
Please look into it and do the needful
Getting 404 for report link.
Correct me if I’m wrong – this method is part of your Cucumber 6 adapter plugin right?
This is a method from Cucumber
Thanks Mounish, that is exactly what I needed. However I’m facing one problem – it seems to me that screenshots are not being generated at all. I’m using cucumber v. 6.8.0 and Surefire maven plugin 2.22.0.
Here’s my extent.properties file:
extent.reporter.spark.start=true
extent.reporter.spark.out=test-output/SparkReport/Spark.html
extent.reporter.spark.config=src/test/resources/extent-config.xml
screenshot.dir=test-output/screenshots/
screenshot.rel.path=../screenshots/
And @After method:
@After
public void end(Scenario scenario) {
byte src[] = ((TakesScreenshot)testBase.driver.get()).getScreenshotAs(OutputType.BYTES);
scenario.attach(src, scenario.getName() + “.png”, “”);
testBase.driver.get().quit();
}
There is a get() method following driver instance because I’m using ThreadLocal for parallel execution. What is also curious is fact that runner “sees” extent-config.xml file. Extent report is generated with dark theme – like specified in xml.
Thanks!
Can u try by adding this line instead of one u have now – scenario.attach(src, “image/png”, “”);
Not sure i understood – ‘runner “sees” extent-config.xml file’. Can u explain it more details? Thx
Wow, it worked. But can you tell me WHY it worked?
By “sees” I meant that extent-config.xml file’s content is taken into consideration while report is being generated. I didn’t know if this was valuable info, but included it anyway.
The first parameter is the byte array, second one is the mime type and the the third parameter can be used to add a custom image title in the report.Refer to the source – https://github.com/cucumber/cucumber-jvm/blob/269c62b86580142fbdc9cb544f0a66236f39f955/java/src/main/java/io/cucumber/java/Scenario.java#L61.
How to create report for running in Grid.. Means running in multibrowser on grid..
Just adding the plugin to the runner should work.
No while running multibrowser parallely report is getting messed up… if you can provide some example repo access for grid will be more helpful
Currently I do not have the time to setup a grid. If u want u can share the report and I can have a look.
Another question, I am running multiple runner in parallel using Surefire plugin, Can i somehow give different name to the report based on different runner. or can i update the extent config for different runner.
I do not think this is possible as there is only one instance of ExtentReports class. Refer to the ExtentService class. So even if u have multiple runners, the report will contain all the test run information irrespective of which runner executed the scenario.
in the Spark report for extentreports-cucumber6-adapter 2.0.0, is there a way to customize the fonts and the background color of the steps. Previous version had more clean approach with white background and green/Red ticks for pass or failed steps.
The plugin just sends the data to the existing Extent Spark report. The display is handled by the report Freemarker templates. U can add custom scripts and css in the extent-config.xml. For anything complex u will need to reach out to the developer of ExtentReports. https://github.com/extent-framework/extentreports-java/issues
I need to set systeminfo.os and systeminfo.version getting value from system itself means by not providing in properties file how can we do it
U can access it from the runner class by using ExtentService.getInstance().setSystemInfo(key,value)
Thank you I am able to do it
I have to use same feature files for both platforms.
Also, embedding screenshots as encoded base64 string is not working.
Screenshots are displayed as broken images.
I have tried in two different ways.
1.
@After
public void quit(Scenario scenario) throws IOException {
if(scenario.isFailed()){
String screenshot = new DriverManager().getDriver().getScreenshotAs(OutputType.BASE64);
scenario.attach(screenshot, “image/png”, scenario.getName());
}
2.
if(scenario.isFailed()){
String screenshot = takeScreenShot();
scenario.attach(screenshot, “image/png”, scenario.getName());
}
protected String takeScreenShot() {
try {
File snapshotTmpFile = new DriverManager().getDriver().getScreenshotAs(OutputType.FILE);
File snapshotFile = new File(System.getProperty(“user.dir”) + “/Reports/”, snapshotTmpFile.getName());
FileUtils.moveFile(snapshotTmpFile, snapshotFile);
String encodeImage = convertImageToBase64(snapshotFile);
snapshotFile.delete();
return encodeImage;
} catch (WebDriverException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Convert Image to Base64
*
* @param file
* @return
* @throws IOException
*/
private String convertImageToBase64(File file) throws IOException {
byte[] fileContent = FileUtils.readFileToByteArray(file);
encodedString = Base64.getEncoder().encodeToString(fileContent);
return “data:image/jpg;base64, ” + encodedString;
}
Images as Base64 source strings is currently not supported. U will need to modify the adapter source to make it work. There is an issue open for this functionality. – https://github.com/grasshopper7/extentreports-cucumber6-adapter/issues/11
Hey Mounish,
Thanks for the response. I got it resolved. I was using cucumber 5 versions with cucumber6 adapter.
I have one more query, I am able to implement parallel execution using on multiple devices, and getting the report. But would like to add deviceName or something to differentiate between entries in the report. Currently it looks like same feature got executed twice. Earlier I have used assign category method to append deviceName in order to differentiate tests in parallel execution. But I didn’t find a way to differentiate using your plugin. Please suggest.
For cucumber 5, ideally u should use the cucumber 5 adapter.
Are u using the same feature file for both devices? If they are different u can add different tags to the features.
I have to use same feature file.
Also I want to add screenshots for failed steps as Base64 string to avoid image file sharing along with html file.
I have tried in two ways
1.
@After
public void afterScenario(Scenario scenario) throws IOException {
if(scenario.isFailed()){
String screenshot = new DriverManager().getDriver().getScreenshotAs(OutputType.BASE64);
scenario.attach(screenshot, “image/png”, scenario.getName());
}
}
2.
@After
public void afterScenario(Scenario scenario) throws IOException {
if(scenario.isFailed()){
String screenshot = takeScreenShot();
scenario.attach(screenshot, “image/png”, scenario.getName());
}
protected String takeScreenShot() {
try {
File snapshotTmpFile = new DriverManager().getDriver().getScreenshotAs(OutputType.FILE);
File snapshotFile = new File(System.getProperty(“user.dir”) + “/Reports/”, snapshotTmpFile.getName());
FileUtils.moveFile(snapshotTmpFile, snapshotFile);
String encodeImage = convertImageToBase64(snapshotFile);
snapshotFile.delete();
return encodeImage;
} catch (WebDriverException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Convert Image to Base64
*
* @param file
* @return
* @throws IOException
*/
private String convertImageToBase64(File file) throws IOException {
byte[] fileContent = FileUtils.readFileToByteArray(file);
String encodedString = Base64.getEncoder().encodeToString(fileContent);
return “data:image/jpg;base64, ” + encodedString;
}
When I select the screenshot icon of a failed step, The images are not getting loaded.
Can you please tell me how can i add assign category method in extent cucumber 7 reports?
‘Category’ of Extent is equivalent to ‘Tags’ from cucumber. Add the tags to the feature file and this well be automatically picked up by the report.
Hi Dpedagada, even i have the same requirement , were you able to achieve this?
After modifying the dependencies I am getting
“java.lang.IllegalArgumentException: The plugin specification ‘com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:’ has a problem:
Could not load plugin class ‘com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter’.
Plugin specifications should have the format of PLUGIN[:[PATH|[URI [OPTIONS]]]
Valid values for PLUGIN are: default_summary, html, json, junit, message, null_summary, pretty, progress, rerun, summary, teamcity, testng, timeline, unused, usage
PLUGIN can also be a fully qualified class name, allowing registration of 3rd party plugins. The 3rd party plugin must implement io.cucumber.plugin.Plugin”
I doubt there is a mismatch in my dependencies. Could you please share a pom contents that are required to achieve extent reporting using the above plugin with TestNG and Parallel execution on Mobiles
Check the POM – https://github.com/grasshopper7/cuke6-extent-adapter-report/blob/master/cuke6-extent-adapter-report/pom.xml
Hi,
I am getting the following exception
cucumber.runtime.CucumberException: Unrecognized plugin: com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:
I have followed all the above steps.
But, I feel I have missed something basic. Any idea?
Have u included the cucumber adapter POM dependency
Same issue for me. Found any resolution??
Have you looked at the sample implementation. Just replicate the POM and add your project specific dependencies on top
How to see custom scennario.logs in spark report ?
It will be included in the specific step or hook found in the ‘Tests’ page.
Hi Mounish,
I have just one query , why we can not change the screenshot names as we are paasing name in scenario.attach() method.
scenario.attach(screenshot, “image/png”, screenshotName + “.png”);
bydefault it is taking the name embedded1.png
how I can customize the name?
will wait for your response.
Thanks in advance.
The file and the name is an internal implementation which should not be changed and is hard coded in the code. This is used for creating the ‘src’ path attribute which links the report to the actual file. Why do u want to change the name?
No specific reason, As I store screen shots in a specific folder and customizing the screenshot name with scenario name will make more organize.
Do u also move the reports? If u rename the image files then they will not be displayed properly in the reports.
U could have a look at creating reports in user defined folder names, mentioned in the section `Customized Report Name` above.
Created an issue to investigate if it can be done – https://github.com/grasshopper7/extentreports-cucumber6-adapter/issues/10
Hi,
How can we disable wrapping of string/words when adding in scenario.log(“list of values”).
Basically I am trying to embed sql resultset output in extent report by converting resultset to hashmap and pretty printing hashmap in scenario.log.
This wraps the words if the screen size is full, can he disable wrapping and horizontal scroll bar to the report can be enabled?
U can include the custom css in the extent-config.xml file in the scripts tag. I think u will need to override the css settings in spark-style.css line 34. Wild guess.
Is there any way to generate the system info like OS, Browser version, dynamically in my java code instead of providing static values in properties file?
U could try this – ExtentService.getInstance().setSystemInfo(String k, String v). Should work if included in the runner class.
It must be implemented in a main or any method? Cuz I tried it and it did’nt work ):
Add it in the junit or testng before method in the runner.
Yup. Now it works!
I had jUnit and TestNG Dependencies at the same time in POM
Just deleted jUnit and now I run it from .xml runner file.
Add a name to the Scenario Outline in the feature file, this is necessary as it is used for matching Extent Test objects. Maybe Scenario Outline: Searching stuff
Dear Mounish,
Thank you very much for this plugin. I am using this plugin properly with TestNG runner class with the features where there is no webdriver is involved.
but when i am running a simple youtubesearch where i am instantiating the webdriver in Given scenario, then I see below error is coming in console but test is showing as passed with (zero pass, zero fail and zero skipped) with this plugin
please let me know if i am missing something.
Error is:
java.lang.IllegalArgumentException: nodeName cannot be null or empty
at com.aventstack.extentreports.ExtentTest.createNode(ExtentTest.java:141)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.createScenarioOutline(ExtentCucumberAdapter.java:356)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.handleScenarioOutline(ExtentCucumberAdapter.java:335)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.handleTestCaseStarted(ExtentCucumberAdapter.java:161)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$1(ExtentCucumberAdapter.java:159)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$3.receive(ExtentCucumberAdapter.java:101)
at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$3.receive(ExtentCucumberAdapter.java:1)
at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
at io.cucumber.core.runtime.SynchronizedEventBus.send(SynchronizedEventBus.java:47)
at io.cucumber.core.runtime.ThreadLocalRunnerSupplier$LocalEventBus.send(ThreadLocalRunnerSupplier.java:66)
at io.cucumber.core.runner.TestCase.emitTestCaseStarted(TestCase.java:220)
at io.cucumber.core.runner.TestCase.run(TestCase.java:90)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
at io.cucumber.testng.TestNGCucumberRunner.lambda$runScenario$0(TestNGCucumberRunner.java:116)
at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:117)
at io.cucumber.testng.TestNGCucumberRunner.runScenario(TestNGCucumberRunner.java:113)
at io.cucumber.testng.AbstractTestNGCucumberTests.runScenario(AbstractTestNGCucumberTests.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:77)
at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:15)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Test runner Class is:
package com.seleniumcucumberlearn.TestRunner;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import org.testng.annotations.DataProvider;
@CucumberOptions(
features = {“C:/Users/SambariS/IdeaProjects/com.selenium.learn/src/test/Features/YouTubeSearch.feature”},
glue = “com.seleniumcucumberlearn.StepDef”,
tags = “@Youtube”,
//plugin= {“pretty”, “html:target/site/cucumber-pretty”,”html:target/cucumber.html” },
plugin = {“com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:”},
monochrome = true)
public class TestNGTestRunner extends AbstractTestNGCucumberTests {
@Override
@DataProvider(parallel = true)
public Object[][] scenarios() {
return super.scenarios();
}
}
Feature file is:
@Youtube
Feature: YouTube Search for a given video
Everybody wants to enjoy youtube by searching different content
Scenario Outline:
Given User Opens YouTube
When User enters a “” to Search a Video
Then User should get videos related to the search with title “”
Examples:
| Query | ExpectedOutPut |
| Cricket | YouTube |
| Football | YouTube |
StepDef:
package com.seleniumcucumberlearn.StepDef;
import com.seleniumcucumberlearn.HelperClasses.Helper;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.junit.Assert;
import org.openqa.selenium.By;
import java.util.concurrent.TimeUnit;
public class YouTubeSearch {
Helper helper = new Helper();
@Given(“User Opens YouTube”)
public void user_Opens_YouTube() {
helper.openDriver();
helper.driver.get(“https://www.youtube.com”);
helper.driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
@When(“User enters a {string} to Search a Video”)
public void user_enters_a_String_to_Search_a_Video(String Query) {
helper.driver.findElement(By.xpath(“//input[@id=\”search\”]”)).sendKeys(Query);
helper.driver.findElement(By.cssSelector(“#search-icon-legacy”)).click();
helper.driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
@Then(“User should get videos related to the search with title {string}”)
public void user_should_get_videos_related_to_the_search(String ExpectedOutPut) {
String ActualOutPut = helper.driver.getTitle();
Assert.assertEquals(ActualOutPut, ExpectedOutPut);
helper.closeDriver();
}
}
POM:
UTF-8
UTF-8
1.7
1.7
3.141.59
io.cucumber
6.5.1
extentreports-cucumber6-adapter
1.2.0
io.cucumber
cucumber-java
${cucumber.version}
io.cucumber
cucumber-picocontainer
${cucumber.version}
io.cucumber
datatable-dependencies
3.0.0
io.cucumber
datatable
3.3.1
test
io.cucumber
cucumber-junit
${cucumber.version}
test
io.cucumber
cucumber-testng
${cucumber.version}
tech.grasshopper
${extentreports-cucumber-adapter}
${extentreports-cucumber-adapter-version}
test
I have got a lot of logging with in the Cucumber Steps, how can I use the Log in the StepDefs. SO i want to use it like this:
@Given(“^I have cucumber installed$”)
public void iHaveCucumberInstalled() {
//System.out.println(“Installing Cucumber”);
scenario.log(“Installing Cucumber”);
}
Please go through this comment chain. – https://ghauto.tech/1697/#comment-1148. I think u will find what u r looking for.
Little hazy on the details. So ‘Scenario1’ is to executed in a fresh browser instance. Then ‘Scenario2’ is to be executed in a fresh browser instance. OR is it some other setup? Do clarify. If the former setup, then opening and closing the new driver instance in before and after hook should do the trick.
To run 2 scenarios in parallel, reduce the dataproviderthreadcount to 2. As u r using testng runner, scenarios will run in parallel rather than features in junit.
Req 1:
Invoke Chrome and/or Firefox instances and execute scenarios which were selected in those respective browsers. So lets say we have 10 scenarios, and we want to execute 5 in Chrome and 5 in firefox.
Req 2:
Given above, by default, when executing in parallel 5 Chrome and 5 Firefox instances will be invoked. This may sometimes slow down the system. So, can we limit them?. Like start with 2 instances, and then re-use the same or start new instance..
Easiest to do this with 2 runners and using tags. Run them in parallel using the classes setting of ‘parallel’ in surefire or failsafe. Set the runner dataproviderthread count to 2. Store the driver instances in threadlocal for browser reuse. Hard to explain, created a basic framework here – https://github.com/grasshopper7/browserparallel/tree/master/browserparallel
Thanks for your response Mounish, appreciate your time and efforts in helping me.
Have few queries,
– How do I execute this?
– Can we use Picocontainer to share the state in StepDefs like you did in one of your posts?
– Also, I earlier had Maven calling testng which in turn had reference to the Runner class…is this a good approach or a direct Maven+Cucumber would be good?
– How do I execute this? -> U have to use ‘mvn install’ on the POM, as surefire or failsafe plugin are required to execute the runner classes in parallel.
– Can we use Picocontainer to share the state in StepDefs like you did in one of your posts? -> Yes. U can even use Spring if u want. The reason I have not used the SharedDriver class explicitly, is the requirement to instantiate driver based on browser type.
– Also, I earlier had Maven calling testng which in turn had reference to the Runner class…is this a good approach or a direct Maven+Cucumber would be good? -> Not sure I understand clearly. Can u add some details. Though I kind of prefer Cucumber handle the execution.
Thanks for this beautiful adapter plugin for Cucumber v6.
Great stuff!!!
I have a requirement to execute each of the scenario in different browser…how can we achieve that using Cucumber? I’m kindof stuck to think on a design for the same.
Also, is there a way to control parallel execution in terms of limiting invocation to 2 browsers at a time?
The below code works fine but instead spawns all scenarios in parallel:
dataproviderthreadcount
20
public class RunCucumberTest extends AbstractTestNGCucumberTests{
@Override
@DataProvider(parallel = true)
public Object[][] scenarios() {
return super.scenarios();
}
}
Can you please advise.
hello can someone help me please
I can’t add a screenshot to my report, this is the method of my class
@After
public void TearDown(Scenario scenario) {
if (scenario.isFailed()) {
byte[] src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
scenario.log(scenario.getName() + “is failed”);
scenario.attach(src,”image/png”, scenario.getName() +”.png”);
}
driver.manage().deleteAllCookies();
driver.close();
}
///and this is my extent.properties///
extent.reporter.html.start=true
extent.reporter.logger.start=true
extent.reporter.spark.start=true
extent.reporter.rerunspark.start=true
extent.reporter.html.config=src/test/resources/extent-config.xml
extent.reporter.logger.config=src/test/resources/extent-config-logger.xml
extent.reporter.spark.config=src/test/resources/extent-config.xml
extent.reporter.rerunspark.config=src/test/resources/extent-config.xml
extent.reporter.html.out=test-output/HtmlReport/ExtentHtml.html
extent.reporter.logger.out=test-output/Logger
extent.reporter.spark.out=test-output/Spark
extent.reporter.rerunspark.out=test-output/RerunSpark
screenshot.dir=test-output/
screenshot.rel.path=../
systeminfo.os=Windows
systeminfo.version=8.1
Are the images being generated in the ‘test-output’ folder? Do you see image placeholders in the report and when u click on them nothing comes up? Can u check out the latest code from the repo – https://github.com/grasshopper7/extentreports-cucumber6-adapter. I just ran the tests in it and the images are being displayed. THanks
hi I wrote you here https://github.com/grasshopper7/extentreports-cucumber6-adapter/issues/6
Thanks
When using below options for using multiple tags in cucumber 6:
1) @CucumberOptions(tags= {“@tag1 and @tag2”}) its giving error saying “Type mismatch: cannot convert from String[] to String”
2) @CucumberOptions(tags= {“@tag1” and “@tag2”}) its giving error saying “Syntax error on token “and”, , expected”
3) @CucumberOptions(tags= {“@tag1”, “@tag2”}) its giving error saying “Type mismatch: cannot convert from String[] to String”
@CucumberOptions(tags= “@tag1 and @tag2”) remove the curly braces
Hi Mounish,
Added tag in same format tags= “@tag1 and @tag2” still getting error
java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(ArrayList.java:862)
at java.util.Collections.min(Collections.java:596)
at tech.grasshopper.pdf.data.ReportData.populateSummaryChapterData(ReportData.java:69)
at tech.grasshopper.pdf.data.ReportData.populateChapterData(ReportData.java:29)
at tech.grasshopper.pdf.PDFCucumberReport.(PDFCucumberReport.java:57)
Please help to resolved this
Which version of adapter are u using? Latest one? Is the Spark report getting generated?
Hi Mounish,
Iam also facing the same issue with Cucumber tags and Iam using “ExtentReports Cucumber6 Adapter » 2.6.0”.
Is there a way to solve this tags issue??
Thanks
Hi, Can u add the stacktrace and the tags in the runner? Is the issue with pdf report only? Is the Spark report generated?
I also had the same error, fixed it by adding the below in build.gradle.
implementation ‘com.github.ralfstuckert.pdfbox-layout:pdfbox2-layout:1.0.0’
Thanks for the help the screenshots are now opening in extent report.
But one thing I want to ask you asked me to set screenshots.dir=reports/ since I am creating html and logger report under reports folder?
Secondly is there any way to name the screenshots as be default its showing as embedded1.png and embedded2.png respectively.
But since I have used scenario.getname()+”.png” in scenario.attach() method so its not naming screenshot that way.
Thirdly for executing multiple tags in cucumber 6 what would be the syntax as I have tried both
@CucumberOptions(tags=(“@tag1” and “@tag2”) ) and @CucumberOptions(tags=(“@tag1” and “@tag2″) ) but not allowing me to executing two specific tagged scenario and allowing me to execute only one scenario at a time as
@CucumberOptions(tags=”@tag1”) ?
The adapter code needs to find the images relative to the directory of the report, in your case ‘reports’. The image name prefix ’embedded’ is hard coded and cannot be changed. The third argument that u r passing should be displayed as image title in the reports. Use @CucumberOptions(tags={“@tag1 and @tag2”} ).
PFB the content of extent.properties file
#extent.properties
extent.reporter.avent.start=false
extent.reporter.bdd.start=false
extent.reporter.cards.start=false
extent.reporter.email.start=false
extent.reporter.html.start=true
extent.reporter.klov.start=false
extent.reporter.logger.start=true
extent.reporter.tabular.start=false
extent.reporter.avent.config=
extent.reporter.bdd.config=
extent.reporter.cards.config=
extent.reporter.html.config=
extent.reporter.klov.config=
extent.reporter.logger.config=
extent.reporter.tabular.config=
extent.reporter.avent.out=
extent.reporter.bdd.out=
extent.reporter.cards.out=
extent.reporter.email.out=
extent.reporter.html.out=reports/HtmlReport/ExtentHtml.html
extent.reporter.logger.out=reports/LoggerReport/
extent.reporter.tabular.out=
screenshot.dir=screenshots//
screenshot.rel.path=../
Ur screenshot properties are wrong. Try the below values.
screenshot.dir=reports/
screenshot.rel.path=../
I have set the screenshot properties in extent.properties file as
screenshot.dir=screenshots//
screenshot.rel.path=../
The screenshots are generated (and opened)in screenshots folder as embedded1.png and embedded2.png and not with name(scenarioname.png) I have passed in scenario.attach method as
@After
public void takeScreenshot(Scenario scenario) throws IOException {
if(scenario.isFailed()) {
byte[] src=((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
scenario.log(scenario.getName()+ “is failed”);
scenario.attach(src,”image/png”, scenario.getName()+ “.png” );
}
}
Also when clicking on screenshot icon in extent report a small white box opens with cross button.
Can u add the complete extent.properties file?
The screenshot is now getting added in cucumber extent report but when clicked it opens small white box with cross button.
Also can you tell me which dependency should I include in pom.xml in cucumber 6 for extent cucumber adapter?
Make sure u have the screenshot properties set in the extent.properties. https://github.com/grasshopper7/cuke6-extent-adapter-report/blob/17e3ca967f5e144e1f544dfe2fbaac9616857477/cuke6-extent-adapter-report/src/test/resources/extent.properties.
its not adding screenshot in extent report as used below code:
@After
public void takeScreenshot(Scenario scenario) {
if(scenario.isFailed()) {
byte[] src=((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
scenario.log(scenario.getName()+ “is failed”);
scenario.attach(src, scenario.getName()+ “.png”,” ” );
}
}
The second argument of the attach() method needs to be the mimetype and not the name of the file that you have passed. It should be “image/png”. Please refer to the linked project for the exact syntax.
I have followed you way as below:
@After
public void takeScreenshot(Scenario scenario) {
if(scenario.isFailed()) {
byte[] src=((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
scenario.log(scenario.getName()+ “is failed”);
scenario.attach(src, scenario.getName()+ “.png”, );
}
}
but not sure what would be third arguement in scenario.attach() function.Also using this screenshot would be attached to extent report but will it open there?
Third argument can be used to provide a name to the image. U can pass an empty string to it if u want. The screenshot will be embedded in the reports and should open in the report by clicking.
In order to attach screenshot to extent report in cucumber 6 using below code:
@After
public void takeScreenshot(Scenario scenario) throws IOException {
if(scenario.isFailed()) {
log.info(scenario.getName()+”is failed”);
File src=((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(src,new File(screenshotdir + scenario.getName()+ “error.png”));
ExtentCucumberAdapter
}
}
but ExtentCucumberAdapter cannot be resolved although I have already generated extent report using
tech.grasshopper
extentreports-cucumber6-adapter
1.0.0
test
Please tell how to resolve it.
For attaching screen shot to extent reports using the adapter refer to this code – https://github.com/grasshopper7/cuke6-extent-adapter-report/blob/17e3ca967f5e144e1f544dfe2fbaac9616857477/cuke6-extent-adapter-report/src/test/java/stepdefs/Stepdefs.java#L110.
I do not understand the ExtentCucumberAdapter line in your code. There is no need to refer to the adapter class. Just add it to CucumberOptions plugin part of the runner.
I’m facing this issue:
java.lang.AbstractMethodError: Receiver class com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$2 does not define or inherit an implementation of the resolved method abstract receive(Lio/cucumber/plugin/event/Event;)V of interface io.cucumber.plugin.event.EventHandler.
Can u add the dependencies you are using? Refer to this project which uses the adapter – https://github.com/grasshopper7/cuke6-extent-adapter-report
Thanks a lot for this documentation, can you please provide us with How to log screenshots and steps that would be much more helpful.
For screenshots u need to use scenario.attach() which is the update for version 6. The scenario.embed() call has been deprecated. Not sure what u mean by ‘log steps’? Extent is displaying that in the reports in the ‘Tests’ section of the various reports.