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

Failed to execute goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:2.0.40:aggregate (serenity-reports) #68

Open
TagiraNara opened this issue Feb 28, 2019 · 13 comments

Comments

@TagiraNara
Copy link

TagiraNara commented Feb 28, 2019

Hello, I have an issue on my draft project (one cucumber feature file so far, two scenario outlines, tagged. Test class is configured so that only one test is executed).
While on my pc (windows) everything works fine, my colleague, who cloned the project faces the problem. The test is passed, but the attempt to aggregate the reports causes failure. Full stack trace:
[INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 39.742 s [INFO] Finished at: 2019-02-28T18:11:27+02:00 [INFO] Final Memory: 51M/541M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:2.0.40:aggregate (serenity-reports) on project test-engine: Execution serenity-reports of goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:2.0.40:aggregate failed: toIndex = 2 -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:2.0.40:aggregate (serenity-reports) on project test-engine: Execution serenity-reports of goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:2.0.40:aggregate failed: toIndex = 2 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution serenity-reports of goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:2.0.40:aggregate failed: toIndex = 2 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 20 more Caused by: java.lang.IndexOutOfBoundsException: toIndex = 2 at java.util.ArrayList.subListRangeCheck(ArrayList.java:1012) at java.util.ArrayList.subList(ArrayList.java:1004) at net.thucydides.core.model.DataTable.lambda$filterStepsWithTagsFrom$3(DataTable.java:246) at java.util.ArrayList.forEach(ArrayList.java:1257) at net.thucydides.core.model.DataTable.filterStepsWithTagsFrom(DataTable.java:243) at net.thucydides.core.model.TestOutcome.withDataRowsfilteredbyTagsFrom(TestOutcome.java:2509) at net.thucydides.core.model.TestOutcome.withDataRowsfilteredbyTag(TestOutcome.java:2496) at net.thucydides.core.reports.TestOutcomes.lambda$matchingOutcomes$33(TestOutcomes.java:592) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at net.thucydides.core.reports.TestOutcomes.matchingOutcomes(TestOutcomes.java:593) at net.thucydides.core.reports.TestOutcomes.withTag(TestOutcomes.java:562) at net.thucydides.core.reports.html.HtmlAggregateStoryReporter.nestedTagReports(HtmlAggregateStoryReporter.java:219) at net.thucydides.core.reports.html.HtmlAggregateStoryReporter.generateReportsForTestResultsIn(HtmlAggregateStoryReporter.java:181) at net.thucydides.core.reports.html.HtmlAggregateStoryReporter.generateReportsForTestResultsFrom(HtmlAggregateStoryReporter.java:134) at net.serenitybdd.maven.plugins.SerenityAggregatorMojo.generateHtmlStoryReports(SerenityAggregatorMojo.java:243) at net.serenitybdd.maven.plugins.SerenityAggregatorMojo.execute(SerenityAggregatorMojo.java:186) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ... 21 more [ERROR] [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/PluginExecutionException

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>biz.tis</groupId>
    <artifactId>test-engine</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <serenity.version>2.0.39</serenity.version>
        <serenity.maven.version>2.0.40</serenity.maven.version>
        <junit.version>4.12</junit.version>
        <serenity.cucumber.version>1.0.6</serenity.cucumber.version>
        <cucumber.version>4.2.3</cucumber.version>
        <slf4j.version>1.7.25</slf4j.version>
        <maven.failsafe.plugin.version>3.0.0-M3</maven.failsafe.plugin.version>
        <maven.compiler.plugin.version>3.7.0</maven.compiler.plugin.version>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <!-- serenity 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>net.serenity-bdd</groupId>
            <artifactId>serenity-rest-assured</artifactId>
            <version>${serenity.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-cucumber</artifactId>
            <version>1.9.31</version>
        </dependency>
        <!-- assetjj dependencies -->
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.12.0</version>
            <scope>test</scope>
        </dependency>
        <!-- hamcrest dependencies -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${maven.failsafe.plugin.version}</version>
                <configuration>
                    <includes>
                        <include>**/*.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>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</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>
</project>

Feature file:

Feature: User authorization

The user is able to authorize via auth server

@success
Scenario Outline: Successful authorization via client credential flow

  Given the existing user wants to login via application "<applicationName>" 
  And navigates to Login page
  When he provides correct credentials 
  Then he is authorized

  @full
  Examples: 
      |applicationName|
      |client1|
      |client2|

  @client1
  Examples:
      |applicationName|
      |client1|

@error
Scenario Outline: Authorization failed in case of bad credentials 

  Given the existing user wants to login via application "<applicationName>"
  And navigates to Login page
  When he provides wrong password
  Then he is redirected to error page

  Examples:
    |applicationName|
    |client1|
    |client2|

The test class uses the following cucumber option:

@CucumberOptions(
         features = "src/test/resources/features/auth-server/"
         glue = {"authServer/stepDefinitions"}, 
         tags = { "@success", "@client1"})

Currently only one feature file is in feature/auth-server folder. And only one class is in authServer.stepDefinitions package.

Only one test is executed as a result - successful authorization via client1.

@wakaleo
Copy link
Member

wakaleo commented Feb 28, 2019

What do the feature files look like?

@TagiraNara
Copy link
Author

Hi @wakaleo,
I've updated my description. Thank you.

@wakaleo
Copy link
Member

wakaleo commented Feb 28, 2019

I can't reproduce this. Can you provide a sample project that reproduces the issue?

@TagiraNara
Copy link
Author

Hi @wakaleo,
The thing is that neither can I. This issue comes from my colleague... The only difference, i guess, is that he's using openJdk, while I'm using oracle jdk.
Tomorrow when I'm at work I will attach the project, thank you.

@wakaleo
Copy link
Member

wakaleo commented Feb 28, 2019

Which versions of Java exactly? It could also be a maven repository issue. Are you building with Gradle or Maven?

@TagiraNara
Copy link
Author

TagiraNara commented Feb 28, 2019

Ok, I was able to reproduce it executing tests via command prompt.

java version is
openjdk version "1.8.0_201"
OpenJDK Runtime Environment (Zulu 8.34.0.1-CA-win64) (build 1.8.0_201-b10)
OpenJDK 64-Bit Server VM (Zulu 8.34.0.1-CA-win64) (build 25.201-b10, mixed mode)

Other configuration:
java version "1.8.0-201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java Hotspot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

What I've noticed, that during this execution the same test is actually executed twice.

If the execution is started from Idea (via test class execution), everything is fine.

@wakaleo
Copy link
Member

wakaleo commented Feb 28, 2019

I suspect a Maven or JDK issue, but I would need a sample project to be sure

@TagiraNara
Copy link
Author

TagiraNara commented Feb 28, 2019

I'm sorry I'm new to maven (I used gradle previously), probably I'm doing something wrong on mvn verify?
The executed command is

>mvn clean verify -Denv=local

System property is used for configuration...

@wakaleo thanks a lot. I will provide it tomorrow morning. I'm unable to connect my laptop to network out of the office.

@TagiraNara
Copy link
Author

TagiraNara commented Mar 1, 2019

Hi @wakaleo , I've uploaded a draft project to https://github.com/TagiraNara/serenity-test

Also today I investigated it a little bit:

  1. the issue is reproducabe if tags are set in CucumberOptions like tags={"@success", "@client1"}. And only when running form terminal with mvn verify:
serenity-test>mvn clean verify
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------------< biz.te:test >-----------------------------
[INFO] Building test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ test ---
[INFO] Deleting c:\dev\serenity-test\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ test ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ test ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ test ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 3 source files to c:\dev\serenity-test\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ test ---
[INFO] Surefire report directory: c:\dev\serenity-test\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running authServer.AuthFlowTest
[main] INFO net.thucydides.core.steps.ConsoleLoggingListener -

-------------------------------------------------------------------------------------
     _______. _______ .______       _______ .__   __.  __  .___________.____    ____
    /       ||   ____||   _  \     |   ____||  \ |  | |  | |           |\   \  /   /
   |   (----`|  |__   |  |_)  |    |  |__   |   \|  | |  | `---|  |----` \   \/   /
    \   \    |   __|  |      /     |   __|  |  . `  | |  |     |  |       \_    _/
.----)   |   |  |____ |  |\  \----.|  |____ |  |\   | |  |     |  |         |  |
|_______/    |_______|| _| `._____||_______||__| \__| |__|     |__|         |__|

 News and tutorials at http://www.serenity-bdd.info
 Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/
 Join the Serenity Community on Rocket Chat at https://serenity-bdd.rocket.chat
 Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport
 Learn Serenity BDD online at http://serenity-dojo.com
-------------------------------------------------------------------------------------

[main] INFO net.thucydides.core.steps.ConsoleLoggingListener - Test Suite Started: User authorization
[main] INFO net.thucydides.core.steps.ConsoleLoggingListener -
 _____ _____ ____ _____   ____ _____  _    ____ _____ _____ ____
|_   _| ____/ ___|_   _| / ___|_   _|/ \  |  _ \_   _| ____|  _ \
  | | |  _| \___ \ | |   \___ \ | | / _ \ | |_) || | |  _| | | | |
  | | | |___ ___) || |    ___) || |/ ___ \|  _ < | | | |___| |_| |
  |_| |_____|____/ |_|   |____/ |_/_/   \_\_| \_\|_| |_____|____/


TEST STARTED: Authorization from application
-------------------------------------------------------------------(user-authorization;authorization-from-application)
User wants to login to client1
Login Page is loaded
Username: user . Password: password
User is redirected to application
User is authorized
[main] INFO net.thucydides.core.steps.ConsoleLoggingListener -
        __    _____ _____ ____ _____   ____   _    ____  ____  _____ ____
  _     \ \  |_   _| ____/ ___|_   _| |  _ \ / \  / ___|/ ___|| ____|  _ \
 (_)_____| |   | | |  _| \___ \ | |   | |_) / _ \ \___ \\___ \|  _| | | | |
  _|_____| |   | | | |___ ___) || |   |  __/ ___ \ ___) |___) | |___| |_| |
 (_)     | |   |_| |_____|____/ |_|   |_| /_/   \_\____/|____/|_____|____/
        /_/

TEST PASSED: Authorization from application
----------------------------------------------------------------------------

1 Scenarios (1 passed)
4 Steps (4 passed)
0m0.450s

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.737 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ test ---
[INFO] Building jar: c:\dev\serenity-test\target\test-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M3:integration-test (default) @ test ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running authServer.AuthFlowTest
[main] INFO net.thucydides.core.steps.ConsoleLoggingListener -

-------------------------------------------------------------------------------------
     _______. _______ .______       _______ .__   __.  __  .___________.____    ____
    /       ||   ____||   _  \     |   ____||  \ |  | |  | |           |\   \  /   /
   |   (----`|  |__   |  |_)  |    |  |__   |   \|  | |  | `---|  |----` \   \/   /
    \   \    |   __|  |      /     |   __|  |  . `  | |  |     |  |       \_    _/
.----)   |   |  |____ |  |\  \----.|  |____ |  |\   | |  |     |  |         |  |
|_______/    |_______|| _| `._____||_______||__| \__| |__|     |__|         |__|

 News and tutorials at http://www.serenity-bdd.info
 Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/
 Join the Serenity Community on Rocket Chat at https://serenity-bdd.rocket.chat
 Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport
 Learn Serenity BDD online at http://serenity-dojo.com
-------------------------------------------------------------------------------------

[main] INFO net.thucydides.core.steps.ConsoleLoggingListener - Test Suite Started: User authorization
[main] INFO net.thucydides.core.steps.ConsoleLoggingListener -
 _____ _____ ____ _____   ____ _____  _    ____ _____ _____ ____
|_   _| ____/ ___|_   _| / ___|_   _|/ \  |  _ \_   _| ____|  _ \
  | | |  _| \___ \ | |   \___ \ | | / _ \ | |_) || | |  _| | | | |
  | | | |___ ___) || |    ___) || |/ ___ \|  _ < | | | |___| |_| |
  |_| |_____|____/ |_|   |____/ |_/_/   \_\_| \_\|_| |_____|____/


TEST STARTED: Authorization from application
-------------------------------------------------------------------(user-authorization;authorization-from-application)
User wants to login to client1
Login Page is loaded
Username: user . Password: password
User is redirected to application
User is authorized
[main] INFO net.thucydides.core.steps.ConsoleLoggingListener -
        __    _____ _____ ____ _____   ____   _    ____  ____  _____ ____
  _     \ \  |_   _| ____/ ___|_   _| |  _ \ / \  / ___|/ ___|| ____|  _ \
 (_)_____| |   | | |  _| \___ \ | |   | |_) / _ \ \___ \\___ \|  _| | | | |
  _|_____| |   | | | |___ ___) || |   |  __/ ___ \ ___) |___) | |___| |_| |
 (_)     | |   |_| |_____|____/ |_|   |_| /_/   \_\____/|____/|_____|____/
        /_/

TEST PASSED: Authorization from application
----------------------------------------------------------------------------

1 Scenarios (1 passed)
4 Steps (4 passed)
0m0.456s

[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.616 s - in authServer.AuthFlowTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- serenity-maven-plugin:2.0.40:aggregate (serenity-reports) @ test ---
[INFO] current_project.base.dir: c:\dev\serenity-test
[INFO] Generating test results for 3 tests
[INFO] Loading requirements from tag providers :[net.thucydides.core.requirements.PackageRequirementsTagProvider@6e948f1c, net.thucydides.core.requirements.FileSystemRequirementsTagProvider@35010a6b, net.thucydides.core.requirements.FileSystemRequirementsTagProvider@343db2f6]
[INFO] 2 requirements loaded after 110 ms
[INFO] 2 related requirements found after 113 ms
[INFO] Generating test outcome reports: false
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  8.927 s
[INFO] Finished at: 2019-03-01T09:26:31+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:2.0.40:aggregate (serenity-reports) on project test: Execution serenity-reports of goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:2.0.40:aggregate failed: toIndex = 2 -> [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/PluginExecutionException
  1. if tags are set in CucucmberOption like tags={"@success and @client1"}, then execution from terminal is successful (reports are aggregated), though test still is executed twice:
serenity-test>mvn clean verify
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------------< biz.te:test >-----------------------------
[INFO] Building test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ test ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ test ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ test ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ test ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 3 source files to c:\dev\serenity-test\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ test ---
[INFO] Surefire report directory: c:\dev\serenity-test\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running authServer.AuthFlowTest
[main] INFO net.thucydides.core.steps.ConsoleLoggingListener -

-------------------------------------------------------------------------------------
     _______. _______ .______       _______ .__   __.  __  .___________.____    ____
    /       ||   ____||   _  \     |   ____||  \ |  | |  | |           |\   \  /   /
   |   (----`|  |__   |  |_)  |    |  |__   |   \|  | |  | `---|  |----` \   \/   /
    \   \    |   __|  |      /     |   __|  |  . `  | |  |     |  |       \_    _/
.----)   |   |  |____ |  |\  \----.|  |____ |  |\   | |  |     |  |         |  |
|_______/    |_______|| _| `._____||_______||__| \__| |__|     |__|         |__|

 News and tutorials at http://www.serenity-bdd.info
 Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/
 Join the Serenity Community on Rocket Chat at https://serenity-bdd.rocket.chat
 Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport
 Learn Serenity BDD online at http://serenity-dojo.com
-------------------------------------------------------------------------------------

[main] INFO net.thucydides.core.steps.ConsoleLoggingListener - Test Suite Started: User authorization
[main] INFO net.thucydides.core.steps.ConsoleLoggingListener -
 _____ _____ ____ _____   ____ _____  _    ____ _____ _____ ____
|_   _| ____/ ___|_   _| / ___|_   _|/ \  |  _ \_   _| ____|  _ \
  | | |  _| \___ \ | |   \___ \ | | / _ \ | |_) || | |  _| | | | |
  | | | |___ ___) || |    ___) || |/ ___ \|  _ < | | | |___| |_| |
  |_| |_____|____/ |_|   |____/ |_/_/   \_\_| \_\|_| |_____|____/


TEST STARTED: Authorization from application
-------------------------------------------------------------------(user-authorization;authorization-from-application)
User wants to login to client1
Login Page is loaded
Username: user . Password: password
User is redirected to application
User is authorized
[main] INFO net.thucydides.core.steps.ConsoleLoggingListener -
        __    _____ _____ ____ _____   ____   _    ____  ____  _____ ____
  _     \ \  |_   _| ____/ ___|_   _| |  _ \ / \  / ___|/ ___|| ____|  _ \
 (_)_____| |   | | |  _| \___ \ | |   | |_) / _ \ \___ \\___ \|  _| | | | |
  _|_____| |   | | | |___ ___) || |   |  __/ ___ \ ___) |___) | |___| |_| |
 (_)     | |   |_| |_____|____/ |_|   |_| /_/   \_\____/|____/|_____|____/
        /_/

TEST PASSED: Authorization from application
----------------------------------------------------------------------------

1 Scenarios (1 passed)
4 Steps (4 passed)
0m0.465s

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.785 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ test ---
[INFO] Building jar: c:\dev\serenity-test\target\test-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M3:integration-test (default) @ test ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running authServer.AuthFlowTest
[main] INFO net.thucydides.core.steps.ConsoleLoggingListener -

-------------------------------------------------------------------------------------
     _______. _______ .______       _______ .__   __.  __  .___________.____    ____
    /       ||   ____||   _  \     |   ____||  \ |  | |  | |           |\   \  /   /
   |   (----`|  |__   |  |_)  |    |  |__   |   \|  | |  | `---|  |----` \   \/   /
    \   \    |   __|  |      /     |   __|  |  . `  | |  |     |  |       \_    _/
.----)   |   |  |____ |  |\  \----.|  |____ |  |\   | |  |     |  |         |  |
|_______/    |_______|| _| `._____||_______||__| \__| |__|     |__|         |__|

 News and tutorials at http://www.serenity-bdd.info
 Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/
 Join the Serenity Community on Rocket Chat at https://serenity-bdd.rocket.chat
 Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport
 Learn Serenity BDD online at http://serenity-dojo.com
-------------------------------------------------------------------------------------

[main] INFO net.thucydides.core.steps.ConsoleLoggingListener - Test Suite Started: User authorization
[main] INFO net.thucydides.core.steps.ConsoleLoggingListener -
 _____ _____ ____ _____   ____ _____  _    ____ _____ _____ ____
|_   _| ____/ ___|_   _| / ___|_   _|/ \  |  _ \_   _| ____|  _ \
  | | |  _| \___ \ | |   \___ \ | | / _ \ | |_) || | |  _| | | | |
  | | | |___ ___) || |    ___) || |/ ___ \|  _ < | | | |___| |_| |
  |_| |_____|____/ |_|   |____/ |_/_/   \_\_| \_\|_| |_____|____/


TEST STARTED: Authorization from application
-------------------------------------------------------------------(user-authorization;authorization-from-application)
User wants to login to client1
Login Page is loaded
Username: user . Password: password
User is redirected to application
User is authorized
[main] INFO net.thucydides.core.steps.ConsoleLoggingListener -
        __    _____ _____ ____ _____   ____   _    ____  ____  _____ ____
  _     \ \  |_   _| ____/ ___|_   _| |  _ \ / \  / ___|/ ___|| ____|  _ \
 (_)_____| |   | | |  _| \___ \ | |   | |_) / _ \ \___ \\___ \|  _| | | | |
  _|_____| |   | | | |___ ___) || |   |  __/ ___ \ ___) |___) | |___| |_| |
 (_)     | |   |_| |_____|____/ |_|   |_| /_/   \_\____/|____/|_____|____/
        /_/

TEST PASSED: Authorization from application
----------------------------------------------------------------------------

1 Scenarios (1 passed)
4 Steps (4 passed)
0m0.446s

[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.592 s - in authServer.AuthFlowTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- serenity-maven-plugin:2.0.40:aggregate (serenity-reports) @ test ---
[INFO] current_project.base.dir: c:\dev\serenity-test
[INFO] Generating test results for 1 tests
[INFO] Loading requirements from tag providers :[net.thucydides.core.requirements.FileSystemRequirementsTagProvider@134d7ffa, net.thucydides.core.requirements.PackageRequirementsTagProvider@20dd5870, net.thucydides.core.requirements.FileSystemRequirementsTagProvider@425b5fe2]
[INFO] 2 requirements loaded after 105 ms
[INFO] 2 related requirements found after 107 ms
[INFO] Generating test outcome reports: false
[INFO] Starting generating reports after 154 ms
[INFO] Configured report threads: 60
[INFO] Test results for 1 tests generated in 922 ms
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M3:verify (default) @ test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.799 s
[INFO] Finished at: 2019-03-01T09:09:31+02:00
[INFO] ------------------------------------------------------------------------

@matthieu-deroo
Copy link

matthieu-deroo commented Apr 24, 2019

I'm currently experiencing the same issue when running a feature file with a single scenario outline with 3 tagged examples. Roughly it looks like this:

Feature: MyFeature
  Description

  Scenario Outline: My scenario outline
    Given I log in to the application using user <user> and password <password>
    And I navigate to my page
    When I do an action
    Then I should see the expected result

  @accept
    Examples:
      | user            | password |
      | [email protected] | test     |

  @production
    Examples:
      | user                | password |
      | [email protected] | test     |

  @training
    Examples:
      | user              | password |
      | [email protected] | test     |

Cucumber options are passed to run only one of the tags (production) and that same tag is also passed to the serenity-maven-plugin. The issue triggers in the code below (net.thucydides.core.model.DataTable), which looks rather sketchy from an outside perspective.

testSteps is a list with one entry: Example #1 with the data from the production example.
exampleTablesContainingTag is a list with one entry: a DataSetDescriptor with tags: production, startRow: 1, rowCount: 1

Now in the lambda you go list.subList(startIndex: 1, toIndex: 2) on the testSteps list with a single entry, which of course fails on an IndexOutOfBoundsException.

public List<TestStep> filterStepsWithTagsFrom(List<TestStep> testSteps, Collection<TestTag> tags) {
	List<DataSetDescriptor> exampleTablesContainingTag = descriptorsWithTagsFrom(tags);

	List<TestStep> filteredSteps = new ArrayList<>();

	exampleTablesContainingTag.forEach(
			table -> {
				filteredSteps.addAll(
						testSteps.subList(table.getStartRow(), table.getStartRow() + table.getRowCount())
				);
			}
	);
	return filteredSteps;
}

I'm happy to add my own sample code, to help reproduce this issue, however since the person above me already did so, I assume it would be overkill.

@wakaleo
Copy link
Member

wakaleo commented Apr 24, 2019

Could you dig into the code and propose a Pull Request?

@gizdolok
Copy link

gizdolok commented Sep 6, 2019

I'm having the exact same problem

Execution serenity-reports of goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:2.0.47:aggregate failed: toIndex = 2 Execution serenity-reports of goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:2.0.47:aggregate failed: toIndex = 2

Always getting this error whenever more than 3 tags are used on the same feature file.

To update this dependency did not help

@TagiraNara
Copy link
Author

@gizdolok, if you use comma separation of tags, you can try using "and" instead in test class where you glue features to steps (like in my previous comment) - for me it's working ok now... Have you tried it?

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

No branches or pull requests

4 participants