Cucumber kotlin:通过 Intellij 启动测试时出现 IllegalStateException

Gra*_*per 6 exception intellij-idea cucumber kotlin cucumber-java

我正在尝试通过 intellij 启动一个黄瓜(用 kotlin 编写)。

我有一个步骤定义类,描述如下:

在此输入图像描述

当我从 Intellij 启动测试时,“Given”方法出现此异常:java.lang.IllegalStateException: Could parse the return type of the lambda at BusinessEventSteps.kt:19

在此输入图像描述

从命令行使用“mvn clean install”时,测试运行良好。

我的环境:

  • 苹果系统
  • 科雷托 11.0.11
  • Intellij 2021.1.1
  • 科特林 1.4.10
  • 黄瓜6.10.4

Gra*_*per 4

找到了解决方法。看来这个问题与原生 Intellij 编译器有关。编辑运行/调试配置并用 Maven 目标替换默认的“构建”步骤,一切正常。

希望这会帮助其他人!

在此输入图像描述