Skip to main content

Cucumber XML Report

XML(eXtensible Markup Language) is a markup language much like HTML or you can say its a software- and hardware-independent tool for storing and transporting data. XML is often used for distributing data over the Internet, web development, separate data from presentation.

XML stores data in plain text format. This provides a software- and hardware-independent way of storing, transporting, and sharing data. XML also makes it easier to expand or upgrade to new operating systems, new applications, or new browsers, without losing data. With XML, data can be available to all kinds of "reading machines" like people, computers, voice machines, news feeds, etc.

To generate XML report in Cucumber use below code:

@CucumberOptions(
    plugin = {"pretty","junit:target/cucumber/cucumber.xml"},
    features = {"features"},
    glue={"com.pb.cucumbertest.stepdefinitions"},
    monochrome = true,
    strict = true,
    dryRun = false,
    tags = {"@singleargument"}
)

Sample Output

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<testsuite errors="0" failures="1" name="io.cucumber.core.plugin.JUnitFormatter" skipped="0" tests="1" time="78.99">
    <testcase classname="Registration, Login and MyAccount" name="Verify Forgot Password Functionality" time="78.816">
        <failure message="/ by zero" type="java.lang.ArithmeticException">
            <![CDATA[Given I am on the home page.................................................passed
And I follow "Sign in" link.................................................passed
When I follow "Forgot your password?" link..................................passed
And I fill in "input[id='email']" with "goswami.tarun77+7@gmail.com"........failed
And I click on "button[type='submit'] span i"...............................skipped

StackTrace:
java.lang.ArithmeticException: / by zero
	at com.pb.cucumbertest.stepdefinitions.StepDefinitions.i_fill_in_with(StepDefinitions.java:167)
	at ✽.I fill in "input[id='email']" with "goswami.tarun77+7@gmail.com"(file:///Users/tarungoswami/git/cucumbertest/cucumbertest/features/Login.feature:25)
]]>
        </failure>
    </testcase>
</testsuite>

Submitted by tgoswami on August 30, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.