【问题标题】:Gradle Wrapper compile and build code and run a single unit testGradle Wrapper 编译和构建代码并运行单个单元测试
【发布时间】:2020-07-11 13:47:39
【问题描述】:

大家好,我在使用 gradle 包装器时遇到了一点问题。 有什么好方法可以编译我的所有代码、编译所有测试并运行一个测试。 这适用于 Jenkins 管道中的脚本命令。

我用过

  • ./gradlew build,运行所有测试
  • ./gradlew build -x test,编译所有主要代码,不允许我运行任何测试

感谢您的帮助

【问题讨论】:

    标签: bash gradle gradlew


    【解决方案1】:

    请参阅 gradle 文档https://docs.gradle.org/current/userguide/java_testing.html#test_filtering

    # Executes all tests in SomeTestClass
    gradle test --tests SomeTestClass
    
    # Executes a single specified test in SomeTestClass
    gradle test --tests SomeTestClass.someSpecificMethod
    
    gradle test --tests SomeTestClass.*someMethod*
    
    # specific class
    gradle test --tests org.gradle.SomeTestClass
    
    # specific class and method
    gradle test --tests org.gradle.SomeTestClass.someSpecificMethod
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-04
      • 2019-01-17
      • 1970-01-01
      • 2018-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多