【问题标题】:Looking for simple gradle project for Karate automation寻找空手道自动化的简单 gradle 项目
【发布时间】:2020-03-09 06:04:43
【问题描述】:

我正在寻找空手道自动化的示例/示例 gradle 项目。在空手道演示中尝试过,但没有帮助。 简单的骨架也有帮助

【问题讨论】:

    标签: testing automation karate


    【解决方案1】:

    请参考此维基页面:https://github.com/intuit/karate/wiki/Gradle

    plugins {
        id 'java'
    }
    
    ext {
        karateVersion = '0.9.5.RC4'
    }
    
    dependencies {
        testCompile "com.intuit.karate:karate-junit5:${karateVersion}"
        testCompile "com.intuit.karate:karate-apache:${karateVersion}"
    }
    
    sourceSets {
        test {
            resources {
                srcDir file('src/test/java')
                exclude '**/*.java'
            }
        }
    }
    
    test {
        useJUnitPlatform()
        systemProperty "karate.options", System.properties.getProperty("karate.options")
        systemProperty "karate.env", System.properties.getProperty("karate.env")
        outputs.upToDateWhen { false }
    }
    
    repositories {
        mavenCentral()
    }
    

    【讨论】:

    • @Peter Thomas,你能帮我了解一下我们什么时候可以发布 RC 版本,或者我们可以在生产中使用这个 RC4 版本吗
    • @TikTik 我可以确认您可以在 prod 中使用 RC4 进行 API 测试 - 等待一些 UI 自动化功能
    【解决方案2】:

    我使用 VSCode,但话虽如此,这是我的通用空手道测试器项目 build.gradle:

    import org.gradle.api.tasks.testing.logging.TestExceptionFormat
    import org.gradle.api.tasks.testing.logging.TestLogEvent
    import org.gradle.api.tasks.testing.TestResult
    import org.gradle.api.tasks.testing.TestResult.ResultType
    
    plugins {
        id "java"
    }
    
    sourceCompatibility = 11
    targetCompatibility = 11
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        def karateVersion = "0.9.6"
        
        testImplementation "com.intuit.karate:karate-junit5:$karateVersion"
        testImplementation "com.intuit.karate:karate-apache:$karateVersion"
    }
    
    sourceSets {
        test {
            resources {
                srcDir file("src/test/java")
                exclude "**/*.java"
            }
        }
    }
    
    test {
        testLogging {
            events  TestLogEvent.FAILED,
                    TestLogEvent.PASSED,
                    TestLogEvent.SKIPPED,
                    TestLogEvent.STANDARD_ERROR,
                    TestLogEvent.STANDARD_OUT
            exceptionFormat TestExceptionFormat.FULL
            showCauses true
            showExceptions true
            showStackTraces true
            outputs.upToDateWhen {false}
            showStandardStreams true
        }
        
        useJUnitPlatform()
        systemProperty "karate.options", System.properties.getProperty("karate.options")
        systemProperty "karate.env", System.properties.getProperty("karate.env")
    }
    
    task karateExecute(type: JavaExec) {
        classpath = sourceSets.test.runtimeClasspath
        main = "com.intuit.karate.cli.Main"
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-01
      • 1970-01-01
      • 2016-08-22
      相关资源
      最近更新 更多