当前位置: 首页 > 知识库问答 >
问题:

在AWS CodeBuild通行证上运行带有类路径的独立jar,但测试实际上并不运行

邓英卓
2023-03-14

我使用这里描述的策略来运行独立空手道。jar和自定义jar(实现LogModifier):

java -cp karate.jar:seesaw-karate.jar:./tests/java com.intuit.karate.Main ./tests/api

这在我的本地机器上非常有效,但在AWS CodeBuild上运行时会看到奇怪的行为:测试报告为通过,但需要0秒,并且没有显示输出,这表明它们没有实际运行。

CodeBuild作业在openjdk11上的 /aws/codebuild/standard: 3.0映像上运行。

openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

比较我当地的环境:

java version "12.0.2" 2019-07-16
Java(TM) SE Runtime Environment (build 12.0.2+10)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

注意:我们之前运行的java-jarkarate.jar在同一个CodeBuild环境中运行成功。我的理解是,我们需要执行类路径方法来包含多个jar文件(我们需要这样做才能使用LogModifer)。如果有更好的方法,请纠正我!

下面是容器中的一些日志:

[Container] 2021/03/10 01:31:46 Running command java -Dkarate.config.dir=$RELOADED_DIR/exp/ss2_gql/tests/api/config -Dss2GqlUri=$RELOADED_HTTP_URL -DwsUri=$RELOADED_WS_URL -cp "${RELOADED_DIR}/exp/ss2_gql/karate.jar:${RELOADED_DIR}/exp/ss2_gql/seesaw-karate.jar:${RELOADED_DIR}/exp/ss2_gql/tests/java" com.intuit.karate.Main $RELOADED_DIR/exp/ss2_gql/tests/api --tags ~@ignore -o .karate-output
01:31:50.265 [main]  INFO  com.intuit.karate.Main - Karate version: 0.9.6
Warning: Nashorn engine is planned to be removed from a future JDK release
01:31:51.993 [main]  INFO  com.intuit.karate.Runner - waiting for parallel features to complete ...
01:31:52.741 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 1 of 25: 01/exp/ss2_gql/tests/api/conversation_test.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/conversation_test.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.conversation_test.json
scenarios:  9 | passed:  9 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.752 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 2 of 25: 01/exp/ss2_gql/tests/api/migrate_conversation_test.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/migrate_conversation_test.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.migrate_conversation_test.json
scenarios:  1 | passed:  1 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.761 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 3 of 25: 01/exp/ss2_gql/tests/api/conv_search.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/conv_search.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.conv_search.json
scenarios:  1 | passed:  1 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.788 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 5 of 25: 01/exp/ss2_gql/tests/api/org_test.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/org_test.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.org_test.json
scenarios:  4 | passed:  4 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.829 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 22 of 25: 01/exp/ss2_gql/tests/api/message_notifications_test.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/message_notifications_test.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.message_notifications_test.json
scenarios:  1 | passed:  1 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.846 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 23 of 25: 01/exp/ss2_gql/tests/api/auth_test.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/auth_test.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.auth_test.json
scenarios:  2 | passed:  2 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.858 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 24 of 25: 01/exp/ss2_gql/tests/api/update_conversation_read_status_test.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/update_conversation_read_status_test.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.update_conversation_read_status_test.json
scenarios:  2 | passed:  2 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.908 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 25 of 25: 01/exp/ss2_gql/tests/api/people_search.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/people_search.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.people_search.json
scenarios: 11 | passed: 11 | failed:  0 | time: 0.0000
---------------------------------------------------------

HTML report: (paste into browser to view) | Karate version: 0.9.6
file:/codebuild/output/src992/src/s3/00/.karate-output/surefire-reports/karate-summary.html
===================================================================

Karate version: 0.9.6
======================================================
elapsed:   2.43 | threads:    1 | thread time: 0.00 
features:     8 | ignored:   17 | efficiency: 0.00
scenarios:   31 | passed:    31 | failed: 0
======================================================

共有1个答案

束志业
2023-03-14

好的,您可以重新尝试1.0 RC系列吗,因为这已经接近最终版本,我们将开发人员的工作重点放在以下方面:https://github.com/intuit/karate/wiki/1.0-upgrade-guide

因为我想这是一个JDK兼容性问题,我们希望新的解决方案能够解决这个问题。同样重要的是,您开始使用新版本进行测试,以便我们有机会修复您可能发现的任何其他差距。

 类似资料:
  • 我有一个运行selenium phpunit测试的ant构建脚本。我可以在命令行上运行构建脚本,然后看到测试正在进行,浏览器窗口打开,并且selenium测试正在执行。命令行上一切正常。 但是,如果我得到创建一个jenkins jobs来运行构建脚本。它在尝试运行phpunit任务时失败。这是控制台输出。 看起来,当jenkins运行构建时,它不能访问Selenium。请参阅“访问被拒绝”和“网页

  • 我已经在NetBeans中创建了一个Java项目,自动构建的分发文件(.jar)在我的Ubuntu15.04AMD64机器上运行得非常好。 我想在发布它之前确保它在windows上运行,但在windows 7 32位机器上测试后,我发现它不工作。下面是错误消息的屏幕截图。 我可以猜到一些问题--因为它谈到了一个。regex错误。我并没有在代码中真正使用regex,而是使用string.split。

  • null 大多数文档描述了如何在Kubernetes上运行Spark集群。在Kubernetes上独立运行Spark的方法是什么?

  • 我创建了两个类来计算数字,其中一个类同步执行,另一个类将其分成两半,并在两个线程中执行这两半。(intel i5(4个CPU),8GB ram)代码如下: 公共类: 多线程执行:public class Sheet2{

  • 我的项目是一个多模块分级项目,使用Scala。 测试类位于src/Test/scala/xxx/xxxx/xxx/xxxx/xxxxx/xxxxx下,每次尝试从IDE运行时,都会得到相同的错误: 测试类不是什么花哨的,简单的jUnit测试: