Стартовый конфиг Gradle для автотестов на Kotlin

Привет. Давно сюда ничего не писал. Сегодня будет короткий пост, а именно, мой стартовый конфиг Gradle для автотестов на Kotlin. Тут у нас будут: Allure, Selenide, Rest Assured, Kotlinx-serialization, Aspectjweaver.

plugins {
    id 'org.jetbrains.kotlin.jvm' version '1.7.20'
    id 'application'
    id 'org.jetbrains.kotlin.plugin.serialization' version '1.7.20'
    id "io.qameta.allure" version "2.11.2"
}

group = 'org.example'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

def allureVersion = "2.19.0"
def restAssuredVersion = "5.2.0"

dependencies {
    testImplementation 'org.jetbrains.kotlin:kotlin-test'
    implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1"

    testImplementation(platform("org.junit:junit-bom:5.9.1"))
    testImplementation "org.junit.jupiter:junit-jupiter"
    implementation "com.codeborne:selenide:6.9.0"
    
    // Allure
    testImplementation "org.aspectj:aspectjweaver:1.9.5"
    implementation "io.qameta.allure:allure-junit5:${allureVersion}"
    implementation "io.qameta.allure:allure-commandline:${allureVersion}"
    implementation "io.qameta.allure:allure-assertj:${allureVersion}"
    implementation "io.qameta.allure:allure-rest-assured:${allureVersion}"
    implementation "io.qameta.allure:allure-java-commons:${allureVersion}"
    implementation "io.qameta.allure:allure-selenide:${allureVersion}"

    testImplementation "io.rest-assured:rest-assured:${restAssuredVersion}"
    testImplementation "io.rest-assured:kotlin-extensions:${restAssuredVersion}"
}

test {
    useJUnitPlatform()
    testLogging {
        events("PASSED", "STARTED", "FAILED", "SKIPPED")
    }
}

tasks.withType(Test) {
    if (System.getProperty("threads") != null) {
        systemProperties += ['junit.jupiter.execution.parallel.enabled'                 : true,
                             'junit.jupiter.execution.parallel.mode.default'            : 'concurrent',
                             'junit.jupiter.execution.parallel.mode.classes.default'    : 'concurrent',
                             'junit.jupiter.execution.parallel.config.strategy'         : 'fixed',
                             'junit.jupiter.execution.parallel.config.fixed.parallelism': System.getProperty("threads").toInteger()]
    }
    testLogging {
        lifecycle {
            events("PASSED", "STARTED", "FAILED", "SKIPPED")
            exceptionFormat "short"
        }
    }
}

task base_tests(type: Test) {
    useJUnitPlatform {
        includeTags "Simple"
        includeTags "UI"
    }
}

compileKotlin {
    kotlinOptions.jvmTarget = '1.8'
}

compileTestKotlin {
    kotlinOptions.jvmTarget = '1.8'
}

application {
    mainClassName = 'MainKt'
}

Ответить

Ваш адрес email не будет опубликован.