Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Bad values in xml [mocha] #29

Closed
danielsaf opened this issue Sep 21, 2016 · 17 comments
Closed

Bad values in xml [mocha] #29

danielsaf opened this issue Sep 21, 2016 · 17 comments

Comments

@danielsaf
Copy link

danielsaf commented Sep 21, 2016

Hi, I need help. After change my Repository URL for bitbucket - allure report stopped work. I see this error on Jenkins log.

Can one help me whit this?

Wrote xunit report to [./junitTestReport].
Wrote xunit report to [./junitTestReport].
[webdriverIo] $ /Users/Shared/Jenkins/Home/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/allure/bin/allure generate "/Users/Shared/Jenkins/Home/workspace/webdriverIo/allure-results" "/Users/Shared/Jenkins/Home/workspace/webdriverIo/allure3553398422129496538.tmp/environment" -o "/Users/Shared/Jenkins/Home/workspace/webdriverIo/allure3553398422129496538.tmp/allure-report"
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Long.parseLong(Long.java:601)
    at java.lang.Long.valueOf(Long.java:803)
    at com.sun.xml.internal.bind.DatatypeConverterImpl._parseLong(DatatypeConverterImpl.java:118)
    at ru.yandex.qatools.allure.model.Step_JaxbXducedAccessor_stop.parse(TransducedAccessor_field_Long.java:50)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:195)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:559)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:538)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:153)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:243)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:221)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:276)
    at javax.xml.bind.JAXB.unmarshal(JAXB.java:242)
    at ru.yandex.qatools.allure.commons.AllureFileUtils.unmarshal(AllureFileUtils.java:59)
    at ru.yandex.qatools.allure.commons.AllureFileUtils.unmarshal(AllureFileUtils.java:50)
    at ru.yandex.qatools.allure.commons.AllureFileUtils.unmarshal(AllureFileUtils.java:40)
    at ru.yandex.qatools.allure.data.io.TestSuiteReader$TestSuiteResultIterator.next(TestSuiteReader.java:48)
    at ru.yandex.qatools.allure.data.io.TestSuiteReader$TestSuiteResultIterator.next(TestSuiteReader.java:1)
    at ru.yandex.qatools.allure.data.io.TestCaseReader$TestCaseResultIterator.nextSuite(TestCaseReader.java:46)
    at ru.yandex.qatools.allure.data.io.TestCaseReader$TestCaseResultIterator.hasNext(TestCaseReader.java:56)
    at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:57)
    at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:53)
    at ru.yandex.qatools.allure.AllureMain.main(AllureMain.java:48)
Command aborted due to exception {}.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
    at ru.yandex.qatools.allure.command.ReportGenerate.runUnsafe(ReportGenerate.java:48)
    at ru.yandex.qatools.allure.command.AbstractCommand.run(AbstractCommand.java:52)
    at ru.yandex.qatools.allure.CommandLine.main(CommandLine.java:46)
Build step 'Allure Report' marked build as failure
Recording test results
Finished: FAILURE
@christian-bromann
Copy link
Contributor

Duplicate of #26

@just-boris
Copy link
Collaborator

I'd like to clear some points before moving the conversation to #26. The resulting error is the same, but reasons of it can be different.

As I see, here is step stop attribute has empty value <step stop="" />, not testcase.

@danielsaf could you please specify, which test framework are you using and what wdio-* libraries you have in your project?

Also, I don't understand the step "change my Repository URL for bitbucket"? Do you mean that the same source code but run from bitbucket produces the error? How did it work before?

@danielsaf
Copy link
Author

@just-boris
I'm using framework "wdio-mocha-framework": "^0.4.3".
My wdio.conf.js looks:

framework: 'mocha',
//
// Test reporter for stdout.
// The only one supported by default is 'dot'
// see also: http://webdriver.io/guide/testrunner/reporters.html
reporters: ['dot','spec','allure','junit'],
reporterOptions: {
junit: {
outputDir: './junitTestReport'
},
allure: {
outputDir: 'allure-results'
}
},

//
// Options to be passed to Mocha.
// See the full list at http://mochajs.org/
mochaOpts: {
    ui: 'bdd',
    timeout: 9999999,
    compilers: ['js:babel-core/register']
},

My Jenkins view:
webdriverio config jenkins

@danielsaf
Copy link
Author

danielsaf commented Sep 21, 2016

@just-boris
"Also, I don't understand the step "change my Repository URL for bitbucket"? Do you mean that the same source code but run from bitbucket produces the error? How did it work before?" - Please don't care about this. I thought problem was when I has change account from github to bitbucket. But now It's doesn't matter. I don't know why it worked before with the same configuration and now I have a problem.

@just-boris just-boris changed the title Allure report for bitbucket acount. Bad values in xml [mocha] Sep 26, 2016
@Efefefef
Copy link

Efefefef commented Oct 11, 2016

@just-boris Hi! Do you still need a demo project to figure out this bug ? The bug is still here.

@fijijavis
Copy link

fijijavis commented Nov 10, 2016

I too am seeing this issue with <step stop="" />. Looking at my Allure XML it appears to happen when a step has child steps AND it is the last step in the testcase.

I'm using Mocha and here are my wdio-* packages:
"wdio-allure-reporter": "0.1.1",
"wdio-json-reporter": "0.1.0",
"wdio-mocha-framework": "0.5.3",

@DanielBrierton
Copy link

Just to add, as it may help track down the issue: I had this issue, but don't anymore since disabling wdio-sync and using Promises to write my tests.

@devotee101
Copy link

I'm also seeing this issue using cucumber, specifically when I have a test with multiple assertions and the first one fails and the second one passes.

I've put a repo together that demonstrates the issue, here - https://bitbucket.org/vividcloud/wdio-allure-reporter-bug

A NumberFormatException occurs when generating the report because of empty stop and status attributes on one of the test-case elements, as per this gist.

@just-boris
Copy link
Collaborator

Update here!

I could reproduce the issue in test-cases that we have in our repository itself. See PR #33
The following code causes problem:

it('test with leaked step', function () {
        return browser
            .url('/index.html')
            .then(function () {
                // look, there is no return!
                browser.click('#clickable').then(function () {
                    console.log('done')
                })
            })
    })

When we don't return promise from some handlers, they will be recorded in a wrong order. So, the easiest solution will be fixing test codebase to make sure, that all command results are handled. This is what we did in webdriverio/webdriverio#1461, but we can't fix something in users' code.

Dear thread, could you please check your code and look for unhandled calls, like in the code example above. Does problem appear again, even when you handled all commands properly?

@DanielBrierton
Copy link

DanielBrierton commented Nov 15, 2016

@just-boris: Makes sense. I wonder could there be a bug somewhere in wdio-sync then, since I was seeing errors with that, but not with Promises?

EDIT: Ok, I must have been doing something wrong. Re-enabled sync, and reworked my tests/commands to use sync, and all is well now.

EDIT 2: Further info: my wdio-sync is sorted (I think - I don't actually know what I did, but it works now!). I've encountered this when doing it.only on a failing test case, which has no Promises to be seen, all sync calls, and works fine with a full suite.

@wallynm
Copy link

wallynm commented Dec 30, 2016

Hey guys, i've figure out the problem related to this. It's inside the allure-js-common package.
I've made a pull request for them to fix that, the actual problem it's when we execute methods like waitForExist the allure-js-common pass a undefined data, and the xml data i'ts been saved as empty string like "".

Here's the PR for you guys checkout:
allure-framework/allure-js-commons#25

If any of you won't wait for them accept the pr to make the allure-report worl just clone my forked version of the wdio-allure-reporter. I've forked both repositories to fix this, the wdio-allure-reporter needed to be forked to change the package reference and use my edited one.

Allure reporter with updated package: https://github.com/wallynm/wdio-allure-reporter
New allure-js-common package: https://github.com/wallynm/allure-js-commons

Just install it, (in my case i need to install it globally) and the XML's should be generated correctly.

npm install https://github.com/wallynm/wdio-allure-reporter.git -g

@kevinmcdonnell
Copy link

Hey guys,

I am experiencing unstable allure reporter using mocha (sometimes the report fails to generate). The tests, app, jenkins, allure etc are all consistent. It feels like some wdio commands return a result that sometimes affects the report. If I am following these threads correctly (allure-framework/allure-js-commons#25 (comment)), a fix is needed somewhere in webdriverio.

Is there any progress here? I'm not sure where to start looking, any pointers and I'm happy to try help.

[workspace] $ /var/lib/jenkins/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/1.4.23/bin/allure generate "/var/lib/jenkins/jobs/api-assess-ui-env/workspace/reports/js/ui/results/allure" "/var/lib/jenkins/jobs/api-assess-ui-env/workspace/allure2185845511107775597.tmp/environment" -o "/var/lib/jenkins/jobs/api-assess-ui-env/workspace/allure2185845511107775597.tmp/allure-report"
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
	at java.lang.NumberFormatException.forInputString(Unknown Source)
	at java.lang.Long.parseLong(Unknown Source)
	at java.lang.Long.valueOf(Unknown Source)
	at com.sun.xml.internal.bind.DatatypeConverterImpl._parseLong(Unknown Source)
	at ru.yandex.qatools.allure.model.Step_JaxbXducedAccessor_stop.parse(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StructureLoader.startElement(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown Source)
	at javax.xml.bind.JAXB.unmarshal(Unknown Source)
	at ru.yandex.qatools.allure.commons.AllureFileUtils.unmarshal(AllureFileUtils.java:59)
	at ru.yandex.qatools.allure.commons.AllureFileUtils.unmarshal(AllureFileUtils.java:50)
	at ru.yandex.qatools.allure.commons.AllureFileUtils.unmarshal(AllureFileUtils.java:40)
	at ru.yandex.qatools.allure.data.io.TestSuiteReader$TestSuiteResultIterator.next(TestSuiteReader.java:48)
	at ru.yandex.qatools.allure.data.io.TestSuiteReader$TestSuiteResultIterator.next(TestSuiteReader.java:1)
	at ru.yandex.qatools.allure.data.io.TestCaseReader$TestCaseResultIterator.nextSuite(TestCaseReader.java:46)
	at ru.yandex.qatools.allure.data.io.TestCaseReader$TestCaseResultIterator.hasNext(TestCaseReader.java:56)
	at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:61)
	at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:53)
	at ru.yandex.qatools.allure.AllureMain.main(AllureMain.java:48)
Command aborted due to exception {}.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
	at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
	at ru.yandex.qatools.allure.command.ReportGenerate.runUnsafe(ReportGenerate.java:48)
	at ru.yandex.qatools.allure.command.AbstractCommand.run(AbstractCommand.java:52)
	at ru.yandex.qatools.allure.CommandLine.main(CommandLine.java:46)

@fijijavis
Copy link

@kevinmcdonnell
I'm having the same issue (see above). As a stop gap I wrote a quick shell script to scrub the xml for <step stop="" /> and replace with <step stop="1" />. Here's the script...

for i in ./allure-results/*.xml; do sed -i -e 's/stop=""/stop="1"/g' $i done

@just-boris
Copy link
Collaborator

just-boris commented May 5, 2017

allure-commandline@2.0.0 has been released.
It should fix the error for you. Also esure, that you have allure-js-commons@1.3.0 in your node modules. It is already within dependencies version range of this package, so it should be updated with next npm install.

Please, try v2 and check whether this error happens or not.

@christian-bromann
Copy link
Contributor

@just-boris is there anything that has to be updated in this repo?

@just-boris
Copy link
Collaborator

No, it is all fine.
There is only small change in commandline syntax: #42
Also, Jenkins users should not forget to change the version in their Global tools configuration section. Guide can be found there: https://docs.qameta.io/allure/2.0/#_jenkins

@BorisOsipov
Copy link
Contributor

allure-commandline@2.0.0 has been released. It should fix the error for you.

No simular errors have been reported since may 2017. Looks like it was fixed. I am closing this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants