Cucumber XML Report

Profile picture for user devraj

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>