<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Java &#8211; TestAutomationLabs</title>
	<atom:link href="https://testautomationlabs.com/category/programming-languages/java/feed/" rel="self" type="application/rss+xml" />
	<link>https://testautomationlabs.com</link>
	<description>Quality Matters</description>
	<lastBuildDate>Sat, 22 Feb 2025 15:20:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://testautomationlabs.com/wp-content/uploads/2023/08/imageedit_2_5514276710-150x150.png</url>
	<title>Java &#8211; TestAutomationLabs</title>
	<link>https://testautomationlabs.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Creating Allure Report With Cucumber &#8211; Easy Steps</title>
		<link>https://testautomationlabs.com/creating-allure-report-with-cucumber/</link>
					<comments>https://testautomationlabs.com/creating-allure-report-with-cucumber/#respond</comments>
		
		<dc:creator><![CDATA[TestAutomationLabs]]></dc:creator>
		<pubDate>Sun, 13 Aug 2023 15:49:58 +0000</pubDate>
				<category><![CDATA[Automation Testing]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Allure Report With Cucumber]]></category>
		<guid isPermaLink="false">https://testautomationlabs.com/?p=291</guid>

					<description><![CDATA[Allure report with cucumber java &#124; Cucumber is a popular BDD (Behavior-Driven Development) framework that allows you to write tests in a human-readable format. While Cucumber offers powerful testing capabilities, customized test reports can lack visual appeal and detailed insights. Allure is a versatile reporting tool that interfaces seamlessly with Cucumber, allowing you to create [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><strong><em>Allure report with cucumber java</em></strong> | Cucumber is a popular BDD (Behavior-Driven Development) framework that allows you to write tests in a human-readable format. While Cucumber offers powerful testing capabilities, customized test reports can lack visual appeal and detailed insights. Allure is a versatile reporting tool that interfaces seamlessly with Cucumber, allowing you to create visually stunning and informative test reports. In this guide, we will explore how to integrate Allure reports with Cucumber using Java.</p>



<p>Adding <a href="https://docs.qameta.io/allure/#_cucumber_jvm" data-type="link" data-id="https://docs.qameta.io/allure/#_cucumber_jvm" target="_blank" rel="noopener">Allure</a> reports to Cucumber in a Java project requires a few steps. Allure is a simple and powerful reporting tool that can enhance the visualization of your Cucumber test results. Here&#8217;s how you can integrate Allure with Cucumber in a Java project:</p>



<h2 class="wp-block-heading"><strong>Prerequisites</strong></h2>



<p>Before we jump into the integration process, ensure you have the following in place:</p>



<ol class="wp-block-list">
<li>A Java project with Cucumber tests is already set up.</li>



<li>Dependencies for both Cucumber and Allure added to your project (as mentioned in the guide).</li>
</ol>



<h2 class="wp-block-heading">Allure framework installation steps:</h2>



<p>Start by adding required dependencies like <strong>allure-cucumber-jvm</strong> etc&#8230;</p>



<h4 class="wp-block-heading">Maven:</h4>



<div class="hcb_wrap"><pre class="prism undefined-numbers lang-plain" data-file="pom.xml"><code>&lt;properties&gt;
    &lt;aspectj.version&gt;1.8.10&lt;/aspectj.version&gt;
&lt;/properties&gt;
&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;io.qameta.allure&lt;/groupId&gt;
        &lt;artifactId&gt;allure-cucumber4-jvm&lt;/artifactId&gt;
        &lt;version&gt;LATEST_VERSION&lt;/version&gt;
    &lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;build&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
            &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.20&lt;/version&gt;
            &lt;configuration&gt;
                &lt;argLine&gt;
                    -javaagent:&quot;${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar&quot;
                    -Dcucumber.options=&quot;--plugin io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm&quot;
                &lt;/argLine&gt;
            &lt;/configuration&gt;
            &lt;dependencies&gt;
                &lt;dependency&gt;
                    &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
                    &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;
                    &lt;version&gt;${aspectj.version}&lt;/version&gt;
                &lt;/dependency&gt;
            &lt;/dependencies&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;</code></pre></div>



<h4 class="wp-block-heading">Gradle</h4>



<div class="hcb_wrap"><pre class="prism undefined-numbers lang-plain"><code>// Gradle
implementation &#39;io.qameta.allure:allure-cucumber5-jvm:2.17.3&#39; // Latest version</code></pre></div>



<p>Then execute&nbsp;<code>mvn clean test</code>&nbsp;the goal. After tests are executed allure JSON files will be<br>placed in&nbsp;allure-results&nbsp;the directory by default.</p>



<h3 class="wp-block-heading" id="_features_5">Features</h3>



<p>This adapter provides runtime integration allowing the conversion of Gherkin DSL features into basic Allure features</p>



<h3 class="wp-block-heading" id="_display_name"><a href="https://docs.qameta.io/allure/#_display_name" target="_blank" rel="noopener"></a>Display Name</h3>



<p>Titles for tests and suites are extracted at runtime from&nbsp;<code>.feature</code>&nbsp;files</p>



<h3 class="wp-block-heading" id="_description_4"><a href="https://docs.qameta.io/allure/#_description_4" target="_blank" rel="noopener"></a>Description</h3>



<p>Feature’s description appears on every scenario</p>



<h3 class="wp-block-heading" id="_steps_4"><a href="https://docs.qameta.io/allure/#_steps_4" target="_blank" rel="noopener"></a>Steps</h3>



<p>All scenario steps are automatically translated into allure steps</p>



<h2 class="wp-block-heading">Adding Attachments</h2>



<p>You can simply add an attachment in Java code by annotating the method with <strong>@Attachment</strong> that returns either a String or byte[],</p>



<div class="hcb_wrap"><pre class="prism undefined-numbers lang-plain"><code>import io.qameta.allure.Attachment;
...
@Attachment
public String performedActions(ActionSequence actionSequence) {
    return actionSequence.toString();
}
@Attachment(value = &quot;Page screenshot&quot;, type = &quot;image/png&quot;)
public byte[] saveScreenshot(byte[] screenShot) {
    return screenShot;
}</code></pre></div>



<p>Or you can also add Allure helper methods for this </p>



<div class="hcb_wrap"><pre class="prism undefined-numbers lang-plain"><code>import io.qameta.allure.Allure;
...
Allure.addAttachment(&quot;My attachment&quot;, &quot;My attachment content&quot;);
Path content = Paths.get(&quot;path-to-my-attachment-contnet&quot;);
try (InputStream is = Files.newInputStream(content)) {
    Allure.addAttachment(&quot;My attachment&quot;, is);
}</code></pre></div>



<p>Sample code to Configure Cucumber to Generate Allure reports. This process involves specifying the Allure plugin and the location for generating JSON reports.</p>



<div class="hcb_wrap"><pre class="prism undefined-numbers lang-plain"><code>import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
    plugin = {
        &quot;io.qameta.allure.cucumber5jvm.AllureCucumber5Jvm&quot;,
        &quot;json:target/cucumber-report/cucumber.json&quot; // JSON report location
    },
    features = &quot;src/test/resources/features&quot;,
    glue = &quot;your.step.definitions.package&quot;
)
public class CucumberTestRunner {
}
</code></pre></div>



<h2 class="wp-block-heading">Generating and Viewing Allure Report with Cucumber Java:</h2>



<p>To Generate the Allure Report you can use the following commands</p>



<h4 class="wp-block-heading">Generate the Allure Report in JSON format</h4>



<div class="hcb_wrap"><pre class="prism undefined-numbers lang-plain"><code>allure generate target/cucumber-report</code></pre></div>



<h4 class="wp-block-heading">To open the generated report in the default web browser</h4>



<div class="hcb_wrap"><pre class="prism undefined-numbers lang-plain"><code>allure open</code></pre></div>



<figure class="wp-block-image size-large"><img decoding="async" src="https://studywholenight.com/wp-content/uploads/2023/08/allure-report-with-cucumber-java-1024x409.png" alt="Allure report with cucumber" class="wp-image-2016" title="Creating Allure Report With Cucumber - Easy Steps"></figure>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Combining Allure reports with Cucumber Java tests elevates your testing and reporting experience to new heights. By following the steps outlined in this guide, you can create beautiful and insightful test reports that improve performance, minimize errors, and provide valuable insights into your test suite&#8217;s performance Embrace and leverage the power of Allure your Cucumber test report moves to the next level.</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://testautomationlabs.com/creating-allure-report-with-cucumber/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
