Yaks on Camel K 找不到集成 .groovy 文件

Yaks on Camel K does not find the integration .groovy file

我在项目中使用 camel k,我尝试使用 yaks 框架来测试集成路由。

当我执行写在 .feature 文件中的开始测试的命令时,找不到 .groovy 文件。 有人知道吗?

helloworld.feature

Feature: Hello
    Scenario: Print hello message
        Given load Camel K integration myIntegration.groovy
        Given Camel K integration myIntegration is running
        Then Camel K integration myIntegration should print Hello world from Camel K!

整合myIntegration.groovy

from('timer:tick?period=10000')
  .setBody()
  .constant('Hello world from Camel K!')
  .to('log:info')

CLI 命令

yaks test helloworld.feature -n dev-camelk 

日志:

[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] 1 Scenarios (1 failed)
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] 3 Steps (1 failed, 2 skipped)
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] 0m1.987s
**[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] com.consol.citrus.exceptions.CitrusRuntimeException: Failed to load Camel K integration from resource mob2.groovy**
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1]     at org.citrusframework.yaks.camelk.CamelKSteps.loadIntegrationFromFile(CamelKSteps.java:141)
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1]     at ✽.load Camel K integration mob2.groovy(classpath:org/citrusframework/yaks/helloworld.feature:3)
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] Caused by: **java.io.FileNotFoundException: class path resource [myIntegration.groovy] cannot be opened because it does not exist**
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1]     at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:199)

谢谢!

你的称呼方式有几个问题。对于 Camel K 集成,集成名称通常是 kebab case,因此,您的功能必须是:

Feature: Hello
Scenario: Print hello message
    Given load Camel K integration myIntegration.groovy
    Given Camel K integration my-integration is running
    Then Camel K integration my-integration should print Hello world from Camel K!

然后,您必须通过--resource选项提供集成文件资源,例如:

yaks run helloworld.feature --resource myIntegration.groovy

希望对您有所帮助!