serenity-bdd / serenity-cucumber-starter

A skeleton project for Serenity BDD and Cucumber JVM
Apache License 2.0
180 stars 285 forks source link

An illegal reflective access operation has occurred #55

Open sag-c8y opened 3 years ago

sag-c8y commented 3 years ago

When running this project although the test is passing but I am getting this error message on console log

[ERROR] WARNING: An illegal reflective access operation has occurred [ERROR] WARNING: Illegal reflective access by net.thucydides.core.steps.StepInterceptor (file:/C:/Users/abcd/.m2/repository/net/serenity-bdd/serenity-core/2.4.24/serenity-core-2.4.24.j ar) to field java.lang.reflect.Method.root [ERROR] WARNING: Please consider reporting this to the maintainers of net.thucydides.core.steps.StepInterceptor [ERROR] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations [ERROR] WARNING: All illegal access operations will be denied in a future release

wakaleo commented 3 years ago

This is due to a guice bug but can safely be ignored.

Rangiferus commented 2 years ago

We usually know that logs like this one can be safely ignored but knowing that, shouldn't we find a way to get rid of them? More people read logs from test executions than developers of automated tests and I would be really nice to present them only valuable information there.

wakaleo commented 2 years ago

You will need to ask the Guice team to fix their code to do that. You might be able to filter them out with the logback config, but I couldnt figure out how to. But if you find a way, please feel free to propose a pull request.

djc6996 commented 2 years ago

Hi, i have the same problem with Illegal reflective access by net.thucydides.core.steps.StepInterceptor:

[ERROR] WARNING: An illegal reflective access operation has occurred
[ERROR] WARNING: Illegal reflective access by net.thucydides.core.steps.StepInterceptor (file:/C:/Users/*********/***/repository/net/serenity-bdd/serenity-core/3.1.20/serenity-core-3.1.20.jar) to field java.lang.reflect.Method
.root
[ERROR] WARNING: Please consider reporting this to the maintainers of net.thucydides.core.steps.StepInterceptor
[ERROR] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[ERROR] WARNING: All illegal access operations will be denied in a future release

All the tests are runned correctly, but when i open the html report and inspect the test, i see that all test have the number of steps equal 0. I use the @Step annotation in all my steps. Could be the error above related to this issue? Thanks in advance for the help.

wakaleo commented 2 years ago

The situation has not changed since my previous comments: there is no way to avoid this warning message (it does not come from the Serenity code), but you can safely ignore it. If it bothers you, I would advise raising a ticket with the Guice team.

djc6996 commented 2 years ago

I understand, but what about the number of step executed in a test that are not shown in the serenity report? Can be connected to this issue? if not do you have any suggestion? thanks

I need to understand if i do something wrong. This is my POM file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>

    <artifactId>test-automation</artifactId>
    <groupId>********************</groupId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>test-automation</name>
    <description>** test automation ***</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <kotlin.code.style>official</kotlin.code.style>
        <kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
        <kotlin.version>1.5.21</kotlin.version>
        <serenity.version>3.1.20</serenity.version>
        <junit5.version>5.6.0</junit5.version>
        <encoding>UTF-8</encoding>
            <tags></tags>
    </properties>

    <dependencies>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-core</artifactId>
            <version>${serenity.version}</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-junit</artifactId>
            <version>${serenity.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test-junit</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test</artifactId>
            <version>${kotlin.version}</version>
        </dependency>

        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>io.github.rybalkinsd</groupId>
            <artifactId>kohttp</artifactId>
            <version>0.12.0</version>
        </dependency>
        <dependency>
            <groupId>io.github.rybalkinsd</groupId>
            <artifactId>kohttp-jackson</artifactId>
            <version>0.12.0</version>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit5.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <version>${junit5.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src/main/kotlin</sourceDirectory>
        <testSourceDirectory>src/test/kotlin</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jvmTarget>1.8</jvmTarget>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                    <includes>
                        <include>**/*Tests.kt</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <includes>
                        <include>**/*Tests.kt</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
            </plugin>
            <plugin>
                <groupId>net.serenity-bdd.maven.plugins</groupId>
                <artifactId>serenity-maven-plugin</artifactId>
                <version>${serenity.version}</version>
                <configuration>
                    <tags>${tags}</tags>
                    <reports>single-page-html</reports>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>net.serenity-bdd</groupId>
                        <artifactId>serenity-single-page-report</artifactId>
                        <version>${serenity.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>net.serenity-bdd</groupId>
                        <artifactId>serenity-core</artifactId>
                        <version>${serenity.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>serenity-reports</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>