java - Cucumber test for Spring Boot can run in "mvn test" but not in "mvn verify" -


summary:

i running tests using cucumber against spring boot application. cucumber test running fine when execute them using "mvn test" fails when execute them in "mvn verify" lifecycle.

details:

my cucumber runner class looks this:

@runwith(cucumber.class) @cucumberoptions(         features = {"src/test/resources/features/creditcardsummary.feature"},         glue = {"th.co.scb.fasteasy.step"},         plugin = {                 "pretty",                 "json:target/cucumber-json-report.json"                 } )  public class creditcardrunnertest {  } 

when execute "mvn test", can see in logs cucumber runner instantiated before maven spring boot plugin instantiates spring boot instance:

-------------------------------------------------------  t e s t s ------------------------------------------------------- running creditcardrunnertest @creditcards feature: post /creditcards/summary   user, basic information, balance and/or last 'n' transactions of given list of credit cards, can provide information further operations.  ...........  2016-11-13 07:29:02.704  info 14716 --- [           main] s.b.c.e.t.tomcatembeddedservletcontainer : tomcat started on port(s): 8090 (http) 2016-11-13 07:29:02.721  info 14716 --- [           main] t.c.s.fasteasy.step.creditcardstepdefs   : started creditcardstepdefs in 13.486 seconds (jvm running 16.661) 

i know cucumber test integration test move run part of "mvn verify" lifecycle phase instead renaming cucumberrunnerit.java , configuring pom.xml follows:

<build>     <plugins>         <plugin>             <groupid>org.springframework.boot</groupid>             <artifactid>spring-boot-maven-plugin</artifactid>             <executions>                 <execution>                     <id>pre-integration-test</id>                     <goals>                         <goal>start</goal>                     </goals>                 </execution>                 <execution>                     <id>post-integration-test</id>                     <goals>                         <goal>stop</goal>                     </goals>                 </execution>             </executions>         </plugin> ...         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-surefire-plugin</artifactid>             <version>2.19.1</version>             <configuration>                 <argline>${surefireargline}</argline>                 <excludes>                     <exclude>**/it.java</exclude>                 </excludes>             </configuration>         </plugin>         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-failsafe-plugin</artifactid>             <version>2.19.1</version>             <executions>                 <execution>                     <id>integration-tests</id>                     <goals>                         <goal>integration-test</goal>                         <goal>verify</goal>                     </goals>                     <configuration>                         <argline>${failsafeargline}</argline>                         <skiptests>${skip.integration.tests}</skiptests>                     </configuration>                 </execution>             </executions>         </plugin>     </plugins> </build> 

when run part of "verify" though, following error:

2016-11-13 07:39:42.921  info 12244 --- [lication.main()] o.s.c.support.defaultlifecycleprocessor  : starting beans in phase 0 2016-11-13 07:39:43.094  info 12244 --- [lication.main()] s.b.c.e.t.tomcatembeddedservletcontainer : tomcat started on port(s): 8090 (http) 2016-11-13 07:39:43.099  info 12244 --- [lication.main()] th.co.scb.fasteasy.application           : started application in 10.41 seconds (jvm running 52.053) [info] [info] --- maven-failsafe-plugin:2.19.1:integration-test (default) @ creditcards ---  -------------------------------------------------------  t e s t s ------------------------------------------------------- running creditcardrunnerit tests run: 1, failures: 0, errors: 1, skipped: 0, time elapsed: 0.716 sec <<< failure! - in creditcardrunnerit initializationerror(creditcardrunnerit)  time elapsed: 0.008 sec  <<< error! cucumber.runtime.cucumberexception: java.lang.arraystoreexception: sun.reflect.annotation.typenotpresentexceptionproxy caused by: java.lang.arraystoreexception: sun.reflect.annotation.typenotpresentexceptionproxy   results :  tests in error:   creditcardrunnerit.initializationerror ▒ cucumber java.lang.arraystoreexceptio...  tests run: 1, failures: 0, errors: 1, skipped: 0  [info] [info] --- maven-failsafe-plugin:2.19.1:integration-test (integration-tests) @ creditcards --- 

i noticed because had set maven spring-boot plugin run during pre-integration-test, executed before cucumber initialized i'm not sure if error. did try configure spring-boot plugin start app during "integration-test" instead of "pre-integration-test" didn't seem much.

any ideas on i'm doing wrong here?

this jdk version related issue. if use jdk 1.8.0u51, solved.

if jdk version higher, problem occur. please use jdk 1.8.0u51 or lower version.

for more, can go through issue. same issue: https://github.com/cucumber/cucumber-jvm/issues/912


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -