Giter Club home page Giter Club logo

cucumber-junit-convert's People

Contributors

dikshita25 avatar fijijavis avatar smeyffret avatar zbynek-nevrly-deltatre avatar znevrly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cucumber-junit-convert's Issues

Background scenarios cause an error

Background steps in feature will cause an error e.g.,

Feature: Feature with background steps
    Background:
        Given some precondition
        And some other precondition

    Scenario: Scenario 1
        When I do something
        Then some result

will cause an error when converting like:

[16:57:09] Error: Missing attribute value. attribute: {classname}, parent: <testcase>
    at new XMLAttribute (\node_modules\xmlbuilder\lib\XMLAttribute.js:14:15)
    at XMLElement.module.exports.XMLElement.attribute (\node_modules\xmlbuilder\lib\XMLElement.js:72:35)
    at XMLElement.module.exports.XMLElement.attribute (\node_modules\xmlbuilder\lib\XMLElement.js:65:16)
    at new XMLElement (\node_modules\xmlbuilder\lib\XMLElement.js:24:14)
    at XMLElement.module.exports.XMLNode.node (\node_modules\xmlbuilder\lib\XMLNode.js:163:15)
    at XMLElement.module.exports.XMLNode.element (\node_modules\xmlbuilder\lib\XMLNode.js:110:28)
    at XMLElement.module.exports.XMLNode.ele (\node_modules\xmlbuilder\lib\XMLNode.js:392:19)
    at TestCase.build (\node_modules\junit-report-builder\src\test_case.js:94:39)
    at \node_modules\junit-report-builder\src\test_suite.js:82:14
    at arrayEach (\node_modules\lodash\lodash.js:530:11)

The solution is to just skip elements of type="background"

Reuse of converter leads to items from previous convert

If you use the converter multiple times, items from previous convert will be present in the export, e.g.

const cucumberJunitConvert = require('../index');

const options1 = {
    inputJsonFile: './tests/resources/cucumber-report-1.json',
    outputXmlFile: './tests/resources/test-report-1.xml',
    featureNameAsClassName: false
}

cucumberJunitConvert.convert(options1);

const options2 = {
    inputJsonFile: './tests/resources/cucumber-report-2.json',
    outputXmlFile: './tests/resources/test-report-2.xml',
    featureNameAsClassName: false
}

cucumberJunitConvert.convert(options2);

Then test-report-2.xml will include items from cucumber-report-1.json

No steps visible in xml report

I have json file generated from cucumber-js:

[
{
"description": "",
"elements": [
{
"description": "",
"id": "as-an-user-i-would-like-to-do-something",
"keyword": "Scenario",
"line": 2,
"name": "As an user I would like to do something",
"steps": [
{
"keyword": "Before",
"hidden": true,
"result": {
"status": "passed",
"duration": 612000000
}
},
{
"arguments": [],
"keyword": "Given ",
"line": 3,
"name": "I open something",
"match": {
"location": "e2e\step-definitions\basic.ts:7"
},
"result": {
"status": "passed",
"duration": 4450000000
}
},
{
"arguments": [],
"keyword": "When ",
"line": 4,
"name": "I go somewhere",
"match": {
"location": "e2e\step-definitions\homepage.ts:7"
},
"result": {
"status": "passed",
"duration": 11374000000
}
},
{
"arguments": [],
"keyword": "And ",
"line": 9,
"name": "I click something",
"match": {
"location": "e2e\step-definitions\details.ts:20"
},
"result": {
"status": "failed",
"duration": 20031000000,
"error_message": "Error: function timed out, ensure the promise resolves within 20000 milliseconds\n at Timeout._onTimeout (user_code_runner.ts:80:18)\n at listOnTimeout (internal/timers.js:554:17)\n at processTimers (internal/timers.js:497:7)"
}
},
{
"arguments": [],
"keyword": "Then ",
"line": 10,
"name": "I expect to see something",
"match": {
"location": "e2e\step-definitions\overview.ts:11"
},
"result": {
"status": "skipped",
"duration": 0
}
},
{
"keyword": "After",
"hidden": true,
"result": {
"status": "passed",
"duration": 174000000
}
}
],
"tags": [],
"type": "scenario"
}
],
"id": "upload-something",
"line": 1,
"keyword": "Feature",
"name": "Upload something",
"tags": [],
"uri": "e2e\features\upload.feature"
}
]

This is one test case with 4 steps and step three failed. I have this information here. But when I generate .xml file from it, then steps details are not visible and whole file looks like this:

there is no info about steps at all so when I display report I cannot see which steps exactly failed.
Is it possible to implement such feature?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.