allure-framework/allure-java

๐Ÿž: [RestAssured]: AttachmentRender Could't render http attachment file

standbyoneself opened this issue ยท 0 comments

What happened?

I am running Rest Assured tests in parallel.

junit-platform.properties

junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.mode.default = same_thread
junit.jupiter.execution.parallel.mode.classes.default = concurrent

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>ru.sbrf.rmc</groupId>
    <artifactId>feed-api-tests</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <junit.version>5.10.2</junit.version>
        <allure.version>2.16.0</allure.version>
        <aspectj.version>1.9.21</aspectj.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.qameta.allure</groupId>
                <artifactId>allure-bom</artifactId>
                <version>${allure.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>5.4.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-rest-assured</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-junit5</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>2.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.github.hakky54</groupId>
            <artifactId>sslcontext-kickstart-for-pem</artifactId>
            <version>6.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>2.0.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.17.1</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.17.1</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.34</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.13.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <argLine>
                        -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                    </argLine>
                    <argLine>
                        -Dfile.encoding=UTF-8
                    </argLine>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>io.qameta.allure</groupId>
                <artifactId>allure-maven</artifactId>
                <version>2.12.0</version>
                <configuration>
                    <reportVersion>2.14.0</reportVersion>
                    <reportDirectory>${project.build.directory}/allure-report</reportDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

Log after running mvn test

[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< ru.sbrf.rmc:feed-api-tests >---------------------
[INFO] Building feed-api-tests 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ feed-api-tests ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/19484527/Desktop/volk/feed-api-tests/src/main/resources
[INFO] 
[INFO] --- compiler:3.13.0:compile (default-compile) @ feed-api-tests ---
[INFO] Nothing to compile - all classes are up to date.
[INFO] 
[INFO] --- resources:3.3.1:testResources (default-testResources) @ feed-api-tests ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources from src/test/resources to target/test-classes
[INFO] 
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ feed-api-tests ---
[INFO] Nothing to compile - all classes are up to date.
[INFO] 
[INFO] --- surefire:3.5.0:test (default-test) @ feed-api-tests ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running SubjectTest
[INFO] Running ThemeTest
[INFO] Running CasesTests
[INFO] Running HashtagTest
[INFO] Running DictionaryTests
[INFO] Running FilterTest
[INFO] Running PresetsTest
[INFO] Running BinaryCategoryTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.010 s -- in BinaryCategoryTest
[INFO] Running ChatsTest
[WARNING] Tests run: 3, Failures: 0, Errors: 0, Skipped: 3, Time elapsed: 0.848 s -- in SubjectTest
[INFO] Running AccountsTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 9.527 s -- in ChatsTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 9.873 s -- in HashtagTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 10.01 s -- in PresetsTest
[ERROR] Tests run: 7, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 15.77 s <<< FAILURE! -- in AccountsTest
[ERROR] FilterTest.shouldReturn200OnFetchingBunchesFilterByFeedAdmin -- Time elapsed: 12.72 s <<< ERROR!
io.qameta.allure.attachment.AttachmentRenderException: Could't render http attachment file
        at io.qameta.allure.attachment.FreemarkerAttachmentRenderer.render(FreemarkerAttachmentRenderer.java:49)
        at io.qameta.allure.attachment.FreemarkerAttachmentRenderer.render(FreemarkerAttachmentRenderer.java:28)
        at io.qameta.allure.attachment.DefaultAttachmentProcessor.addAttachment(DefaultAttachmentProcessor.java:41)
        at io.qameta.allure.restassured.AllureRestAssured.filter(AllureRestAssured.java:117)
        at io.restassured.filter.Filter$filter$3.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at io.restassured.filter.Filter$filter$3.call(Unknown Source)
        at io.restassured.internal.filter.FilterContextImpl.next(FilterContextImpl.groovy:72)
        at io.restassured.filter.log.StatusCodeBasedLoggingFilter.filter(StatusCodeBasedLoggingFilter.java:112)
        at io.restassured.filter.log.ResponseLoggingFilter.filter(ResponseLoggingFilter.java:31)
        at io.restassured.filter.Filter$filter$3.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at io.restassured.filter.Filter$filter$3.call(Unknown Source)
        at io.restassured.internal.filter.FilterContextImpl.next(FilterContextImpl.groovy:72)
        at io.restassured.filter.log.RequestLoggingFilter.filter(RequestLoggingFilter.java:148)
        at io.restassured.filter.Filter$filter$4.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at io.restassured.filter.Filter$filter$2.call(Unknown Source)
        at io.restassured.internal.filter.FilterContextImpl.next(FilterContextImpl.groovy:72)
        at io.restassured.filter.FilterContext$next$1.call(Unknown Source)
        at io.restassured.internal.filter.CsrfFilter.filter(CsrfFilter.groovy:70)
        at io.restassured.filter.Filter$filter$2.call(Unknown Source)
        at io.restassured.internal.filter.FilterContextImpl.next(FilterContextImpl.groovy:72)
        at io.restassured.filter.FilterContext$next$6.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:148)
        at io.restassured.internal.RequestSpecificationImpl.applyPathParamsAndSendRequest(RequestSpecificationImpl.groovy:1704)
        at io.restassured.internal.RequestSpecificationImpl.this$2$applyPathParamsAndSendRequest(RequestSpecificationImpl.groovy)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
        at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1334)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1089)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:791)
        at io.restassured.internal.RequestSpecificationImpl.invokeMethod(RequestSpecificationImpl.groovy)
        at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:46)
        at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:57)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:203)
        at io.restassured.internal.RequestSpecificationImpl.applyPathParamsAndSendRequest(RequestSpecificationImpl.groovy:1710)
        at io.restassured.internal.RequestSpecificationImpl.this$2$applyPathParamsAndSendRequest(RequestSpecificationImpl.groovy)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
        at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1334)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1089)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:791)
        at io.restassured.internal.RequestSpecificationImpl.invokeMethod(RequestSpecificationImpl.groovy)
        at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:46)
        at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:57)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:203)
        at io.restassured.internal.RequestSpecificationImpl.post(RequestSpecificationImpl.groovy:176)
        at io.restassured.internal.RequestSpecificationImpl.post(RequestSpecificationImpl.groovy)
        at FilterTest.shouldReturn200OnFetchingBunchesFilterByFeedAdmin(FilterTest.java:56)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.lang.IndexOutOfBoundsException: start 10520, end 0, length 60214
        at java.base/java.lang.AbstractStringBuilder.checkRange(AbstractStringBuilder.java:1802)
        at java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:680)
        at java.base/java.lang.StringBuffer.append(StringBuffer.java:393)
        at java.base/java.io.StringWriter.write(StringWriter.java:122)
        at freemarker.template.utility.StringUtil.XMLOrHTMLEnc(StringUtil.java:215)
        at freemarker.template.utility.StringUtil.XHTMLEnc(StringUtil.java:105)
        at freemarker.core.HTMLOutputFormat.output(HTMLOutputFormat.java:62)
        at freemarker.core.DollarVariable.accept(DollarVariable.java:68)
        at freemarker.core.Environment.visit(Environment.java:347)
        at freemarker.core.Environment.visit(Environment.java:353)
        at freemarker.core.Environment.visit(Environment.java:353)
        at freemarker.core.Environment.process(Environment.java:326)
        at freemarker.template.Template.process(Template.java:383)
        at io.qameta.allure.attachment.FreemarkerAttachmentRenderer.render(FreemarkerAttachmentRenderer.java:46)
        ... 68 more

[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.90 s -- in FilterTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 20.07 s -- in ThemeTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 23.24 s -- in CasesTests
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 26.24 s -- in DictionaryTests
[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   FilterTest.shouldReturn200OnFetchingBunchesFilterByFeedAdmin:56 ยป AttachmentRender Could't render http attachment file
[INFO] 
[ERROR] Tests run: 26, Failures: 0, Errors: 1, Skipped: 5
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  30.235 s
[INFO] Finished at: 2024-10-21T16:02:17+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.0:test (default-test) on project feed-api-tests: 
[ERROR] 
[ERROR] Please refer to /Users/19484527/Desktop/volk/feed-api-tests/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

This behavior is flaky.

What Allure Integration are you using?

allure-junit5, allure-rest-assured

What version of Allure Integration you are using?

2.16.0

What version of Allure Report you are using?

2.14.0

Code of Conduct

  • I agree to follow this project's Code of Conduct