serenity-bdd/serenity-cucumber-starter

Warning when executing tests WARNING: Illegal reflective access by net.thucydides.core.steps.StepInterceptor ; All scenarios executed, not only tagged scenarios

nemanjaradic opened this issue · 4 comments

Hello everyone, a i am trying to resolve this issue last few days but without any luck. So when i run tests with:
mvn clean verify serenity:aggregate

I am getting following errors:

[ERROR] WARNING: An illegal reflective access operation has occurred
[ERROR] WARNING: Illegal reflective access by net.thucydides.core.steps.StepInterceptor (file:/C:/Users/n.radic/.m2/repository/net/serenity-bdd/serenity-core/2.4.34/serenity-core-2.4.34.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

@type=smoke
Scenario: Create new ..

I am using Java jdk 11.0.11 , Maven 3.8.1

--
This is my pom.xml


4.0.0
cucumber-serenity
cucumber-serenity
1.0.0-SNAPSHOT
jar

<name>cucumber-serenity</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <serenity.version>2.4.34</serenity.version>
    <serenity.maven.version>2.4.34</serenity.maven.version>
    <serenity.cucumber.version>2.4.34</serenity.cucumber.version>
    <encoding>UTF-8</encoding>
</properties>
<dependencies>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-core</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-cucumber6</artifactId>
        <version>${serenity.cucumber.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-rest-assured</artifactId>
        <version>${serenity.version}</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-ensure</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.0.13</version>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.6.2</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M5</version>
            <configuration>
                <skip>true</skip>
                <testFailureIgnore>true</testFailureIgnore>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>3.0.0-M5</version>
            <configuration>
                <includes>
                    <include>**/starter/**/*.java</include>
                    <include>**/starter/*.java</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>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.serenity-bdd.maven.plugins</groupId>
            <artifactId>serenity-maven-plugin</artifactId>
            <version>${serenity.maven.version}</version>
            <dependencies>
                <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>

--

Also i am having troubles executing only tagged scenarios.
command:

mvn clean verify "-Dcucumber.options=--tags @type=smoke" serenity:aggregate

executes all tests and in serenity report displays only tagged ones. My question is why it is running all the tests anyway? Is it related to the first issue described in this post?

Thanks in advance any help is much appreciated :)

I assume that answer is very obvious, but i depleted google search for this issue so i am asking you :)

You can ignore these warnings - there is nothing we can do about them.

Oke, no problem. Do you have any idea or suggestion for other part of the question. I assume when running tagged scenarios only tagged ones are executed not every scenario in feature file, it is really struggling me :)

Aaand yeah adding tags = "@type=smoke", to CucumberOptions resolved the issue with running all tests.
image

Question is already resolved here : #43
And one more thing to add when running cucumber6 use -Dcucumber.filter.tags= @tag to filter by tag in runtime

-Dcucumber.filter.tags= @tag is not running any test.
-Dcucumber.filter.tags= "@tag" is throwing unexpected token :@ error in build

Could you please help if this worked for you.