Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[allure-testng] Could not write Allure test result #197

Closed
1 of 3 tasks
baev opened this issue Feb 11, 2018 · 18 comments · Fixed by #283
Closed
1 of 3 tasks

[allure-testng] Could not write Allure test result #197

baev opened this issue Feb 11, 2018 · 18 comments · Fixed by #283
Labels
theme:api Java API related issue theme:testng TestNG related issue type:bug Something isn't working work:selected for dev Good issue to start working on

Comments

@baev
Copy link
Member

baev commented Feb 11, 2018

from allure-framework/allure2#738

I'm submitting a ...

  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

In my testcase,if run failed,it will throw AllureResultsWriteException

What is the expected behavior?

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

Allure version 2.2.0
Test framework testng@6.12
Allure adaptor allure-testng@2.0-BETA21
Generate report using allure-maven@2.19

Other information

io.qameta.allure.AllureResultsWriteException: Could not write Allure test result
at io.qameta.allure.FileSystemResultsWriter.write(FileSystemResultsWriter.java:43)
at io.qameta.allure.AllureLifecycle.lambda$writeTestCase$12(AllureLifecycle.java:197)
at java.util.Optional.ifPresent(Optional.java:159)
at io.qameta.allure.AllureLifecycle.writeTestCase(AllureLifecycle.java:195)
at io.qameta.allure.testng.AllureTestNg.onTestFailure(AllureTestNg.java:260)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1738)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1722)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1258)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.nio.channels.ClosedByInterruptException
at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202)
at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:216)
at java.nio.channels.Channels.writeFullyImpl(Channels.java:78)
at java.nio.channels.Channels.writeFully(Channels.java:101)
at java.nio.channels.Channels.access$000(Channels.java:61)
at java.nio.channels.Channels$1.write(Channels.java:174)
at com.fasterxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:2085)
at com.fasterxml.jackson.core.json.UTF8JsonGenerator.close(UTF8JsonGenerator.java:1127)
at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3898)
at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3164)
at io.qameta.allure.FileSystemResultsWriter.write(FileSystemResultsWriter.java:41)
... 12 more

@baev baev added type:bug Something isn't working work:selected for dev Good issue to start working on theme:testng TestNG related issue theme:api Java API related issue labels Feb 11, 2018
@baev
Copy link
Member Author

baev commented Feb 11, 2018

@EzioAuditoreDeFirenze it would be much easier for us if you provide a sample project to reproduce the problem

@ubermensch01
Copy link

@baev I had a very similar issue recently with allure-testng:2.6.0, it started with the following:
java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.introspect.AnnotatedMember.getType()Lcom/fasterxml/jackson/databind/JavaType;

Updating the jackson-databind, jackson-annotation and jackson-core dependencies resolved the issue for me. Consider updating those dependencies in allure-java-commons component.

@tlytvyn
Copy link

tlytvyn commented Mar 14, 2018

Updating jackson-core, jackson-annotation and jackson-databind to version 2.9.4 fixed the issue

@AutomatedOwl
Copy link

@tlytvyn how can it be solved without waiting for the bug fix?
should I independently modify and use allure-testng package?

@tlytvyn
Copy link

tlytvyn commented May 6, 2018

@MickyOwly check my reply attentively

@AutomatedOwl
Copy link

I added to my project:
<dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.9.5</version> </dependency> <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.9.5</version> </dependency> <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.9.5</version> </dependency>

However issue is still on going when running tests in parallel after retry:

Exception in thread "TestNG-test=Test-6" io.qameta.allure.AllureResultsWriteException: Could not write Allure test result at io.qameta.allure.FileSystemResultsWriter.write(FileSystemResultsWriter.java:43) at io.qameta.allure.AllureLifecycle.lambda$writeTestCase$12(AllureLifecycle.java:197) at java.util.Optional.ifPresent(Optional.java:159) at io.qameta.allure.AllureLifecycle.writeTestCase(AllureLifecycle.java:195) at io.qameta.allure.testng.AllureTestNg.onTestFailure(AllureTestNg.java:272) at org.testng.internal.TestListenerHelper.runTestListeners(TestListenerHelper.java:67) at org.testng.internal.Invoker.runTestListeners(Invoker.java:1389) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1042) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.nio.channels.ClosedByInterruptException at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202) at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:216) at java.nio.channels.Channels.writeFullyImpl(Channels.java:78) at java.nio.channels.Channels.writeFully(Channels.java:101) at java.nio.channels.Channels.access$000(Channels.java:61) at java.nio.channels.Channels$1.write(Channels.java:174) at com.fasterxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:2085) at com.fasterxml.jackson.core.json.UTF8JsonGenerator._writeStringSegment2(UTF8JsonGenerator.java:1400) at com.fasterxml.jackson.core.json.UTF8JsonGenerator._writeStringSegment(UTF8JsonGenerator.java:1347) at com.fasterxml.jackson.core.json.UTF8JsonGenerator._writeStringSegments(UTF8JsonGenerator.java:1228) at com.fasterxml.jackson.core.json.UTF8JsonGenerator.writeString(UTF8JsonGenerator.java:453) at com.fasterxml.jackson.databind.ser.std.StringSerializer.serialize(StringSerializer.java:41) at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480) at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319) at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3893) at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3164) at io.qameta.allure.FileSystemResultsWriter.write(FileSystemResultsWriter.java:41)

@AutomatedOwl
Copy link

AutomatedOwl commented May 30, 2018

I opened a repository for reproduction of the issue:
https://github.com/AutomatedOwl/allure-testng-result-write-bug

Just clone it and run 'mvn test'.

AutomatedOwl added a commit to AutomatedOwl/allure2-model that referenced this issue Jun 4, 2018
Change OutputStream object to BufferedOutputStream in order to solve allure-framework/allure-java#197 .
Tested and verified.
@AutomatedOwl
Copy link

@baev can you please review allure-framework/allure2-model#16 ?

@baev
Copy link
Member Author

baev commented Jul 11, 2018

@AutomatedOwl done, check it out

@AutomatedOwl
Copy link

Looks like it's fixed in 2.7.0 :)
Thanks @baev for your review

@baev baev closed this as completed Jul 19, 2018
@AvrahamAtia
Copy link

Still a bug at 2.8.0, Log:
Exception in thread "TestNG-test=AccountTab - Sanity-1" io.qameta.allure.AllureResultsWriteException: Could not write Allure test result

@baev
Copy link
Member Author

baev commented Dec 3, 2018

@AvrahamAtia thats maybe a different issue. Could you please provide an example project to reproduce the problem as well as providing full stack trace of the error?

@AvrahamAtia
Copy link

AvrahamAtia commented Dec 4, 2018

@baev It happen When I am using timeOut property of TestNG, Do you any idea why it happen only when I am using timeOut?!
timeOut is a bug only for the Test annotation self, on the BeforeMethod annotation no bug to add timeOut.

@AvrahamAtia
Copy link

AvrahamAtia commented Dec 4, 2018

@baev
Full stack trace:
10:59:48 Exception in thread "TestNG-test=DesignRefreshTest-3" io.qameta.allure.AllureResultsWriteException: Could not write Allure test result
at io.qameta.allure.FileSystemResultsWriter.write(FileSystemResultsWriter.java:43)
10:59:48 at io.qameta.allure.AllureLifecycle.writeTestCase(AllureLifecycle.java:400)
10:59:48 at io.qameta.allure.testng.AllureTestNg.onTestFailure(AllureTestNg.java:272)
10:59:48 at org.testng.internal.TestListenerHelper.runTestListeners(TestListenerHelper.java:67)
10:59:48 at org.testng.internal.Invoker.runTestListeners(Invoker.java:1389)
10:59:48 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1042)
10:59:48 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
10:59:48 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
10:59:48 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
10:59:48 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
10:59:48 at java.lang.Thread.run(Thread.java:748)
10:59:48 Caused by: java.nio.channels.ClosedByInterruptException
10:59:48 at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202)
10:59:48 at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:216)
10:59:48 at java.nio.channels.Channels.writeFullyImpl(Channels.java:78)
10:59:48 at java.nio.channels.Channels.writeFully(Channels.java:101)
10:59:48 at java.nio.channels.Channels.access$000(Channels.java:61)
10:59:48 at java.nio.channels.Channels$1.write(Channels.java:174)
10:59:48 at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
10:59:48 at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
10:59:48 at java.io.FilterOutputStream.close(FilterOutputStream.java:158)
10:59:48 at com.fasterxml.jackson.core.json.UTF8JsonGenerator.close(UTF8JsonGenerator.java:1138)
10:59:48 at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3910)
10:59:48 at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3176)
10:59:48 at io.qameta.allure.FileSystemResultsWriter.write(FileSystemResultsWriter.java:41)
10:59:48 ... 10 more
10:59:48 Suppressed: java.nio.channels.ClosedChannelException
10:59:48 at sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:110)
10:59:48 at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:199)
10:59:48 at java.nio.channels.Channels.writeFullyImpl(Channels.java:78)
10:59:48 at java.nio.channels.Channels.writeFully(Channels.java:101)
10:59:48 at java.nio.channels.Channels.access$000(Channels.java:61)
10:59:48 at java.nio.channels.Channels$1.write(Channels.java:174)
10:59:48 at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
10:59:48 at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
10:59:48 at java.io.FilterOutputStream.close(FilterOutputStream.java:158)
10:59:48 at io.qameta.allure.FileSystemResultsWriter.write(FileSystemResultsWriter.java:42)
10:59:48 ... 10 more

@AvrahamAtia
Copy link

@baev

@AutomatedOwl
Copy link

@baev @AvrahamAtia Managed to reproduce it again with allure-testng 2.8.1 and testng 6.14.3:
https://github.com/AutomatedOwl/allure-testng-result-write-bug

@AutomatedOwl
Copy link

@baev @AvrahamAtia it's reproduced using Maven with JDK8. Upgrading to JDK11 seems to fix the issue.

@AvrahamAtia
Copy link

AvrahamAtia commented Dec 6, 2018

@AutomatedOwl @baev Should I downgrade TestNG or allure? I prefer work with JDK8 not update to JDK11..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:api Java API related issue theme:testng TestNG related issue type:bug Something isn't working work:selected for dev Good issue to start working on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants