How to use evaluate method of io.kotest.engine.tags.active class

Best Kotest code snippet using io.kotest.engine.tags.active.evaluate

build.gradle.kts

Source:build.gradle.kts Github

copy

Full Screen

1@file:Suppress("UnstableApiUsage")2/*3* Copyright (C) 2016 - present Juergen Zimmermann, Hochschule Karlsruhe4*5* This program is free software: you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation, either version 3 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program. If not, see <https://www.gnu.org/licenses/>.17*/18// Aufrufe19// 1) Microservice uebersetzen und starten20// .\gradlew bootRun [-Dport=8081] [-Dhey=true] [--args='--debug'] [--continuous]21// .\gradlew compileKotlin22// .\gradlew compileTestKotlin23//24// 2) Microservice als selbstausfuehrendes JAR erstellen und ausfuehren25// .\gradlew bootJar26// java -jar build/libs/....jar --spring.profiles.active=dev27// .\gradlew bootBuildImage [-Dtag='2.0.0']28// .\gradlew jibDockerBuild -Dtag='1.0.0-jib' [-Ddebug=true]29// erfordert die lokale Windows-Gruppe docker-users30//31// 3) Tests und QS32// .\gradlew test [jacocoTestReport] [--rerun-tasks] [-Dfork=2] [--fail-fast]33// EINMALIG>> .\gradlew downloadAllure34// .\gradlew allureServe35// .\gradlew ktlint detekt36//37// 4) Sicherheitsueberpruefung durch OWASP Dependency Check und Snyk38// .\gradlew dependencyCheckAnalyze --info39// .\gradlew snyk-test40//41// 5) "Dependencies Updates"42// .\gradlew versions43// .\gradlew dependencyUpdates44//45// 6) API-Dokumentation erstellen46// .\gradlew dokkaHtml dokkaJavadoc47//48// 7) Entwicklerhandbuch in "Software Engineering" erstellen49// .\gradlew asciidoctor asciidoctorPdf50//51// 8) "Dependency Verification"52// ./gradlew --write-verification-metadata pgp,sha256 --export-keys53//54// 9) Projektreport erstellen55// .\gradlew projectReport56// .\gradlew dependencyInsight --dependency spring-security-rsa57// .\gradlew dependencies58// .\gradlew dependencies --configuration runtimeClasspath59// .\gradlew buildEnvironment60// .\gradlew htmlDependencyReport61//62// 10) Report ueber die Lizenzen der eingesetzten Fremdsoftware63// .\gradlew generateLicenseReport64//65// 11) Daemon stoppen66// .\gradlew --stop67//68// 12) Verfuegbare Tasks auflisten69// .\gradlew tasks70//71// 13) Initialisierung des Gradle Wrappers in der richtigen Version72// dazu ist ggf. eine Internetverbindung erforderlich73// gradle wrapper --gradle-version=7.4 --distribution-type=bin74// https://github.com/gradle/kotlin-dsl/tree/master/samples75// https://docs.gradle.org/current/userguide/kotlin_dsl.html76// https://docs.gradle.org/current/userguide/task_configuration_avoidance.html77// https://guides.gradle.org/migrating-build-logic-from-groovy-to-kotlin78// TODO https://youtrack.jetbrains.com/issue/KTIJ-1936979@Suppress("DSL_SCOPE_VIOLATION")80plugins {81 java82 idea83 jacoco84 `project-report`85 alias(libs.plugins.kotlinJvm)86 alias(libs.plugins.kotlinSpring)87 alias(libs.plugins.kotlinAllopen)88 alias(libs.plugins.kotlinNoarg)89 alias(libs.plugins.kotlinJpa)90 alias(libs.plugins.springBoot)91 //alias(libs.plugins.springAot)92 // https://github.com/radarsh/gradle-test-logger-plugin93 alias(libs.plugins.testLogger)94 // https://github.com/allure-framework/allure-gradle95 // https://docs.qameta.io/allure/#_gradle_296 alias(libs.plugins.allure)97 // https://github.com/boxheed/gradle-sweeney-plugin98 alias(libs.plugins.sweeney)99 // https://github.com/arturbosch/detekt100 alias(libs.plugins.detekt)101 // https://github.com/Kotlin/dokka102 alias(libs.plugins.dokka)103 // https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin104 alias(libs.plugins.jib)105 // https://github.com/jeremylong/dependency-check-gradle106 alias(libs.plugins.owaspDependencycheck)107 // https://github.com/snyk/gradle-plugin108 alias(libs.plugins.snyk)109 // https://github.com/asciidoctor/asciidoctor-gradle-plugin110 // FIXME https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/597111 alias(libs.plugins.asciidoctor)112 alias(libs.plugins.asciidoctorPdf)113 // Leanpub als Alternative zu PDF: https://github.com/asciidoctor/asciidoctor-leanpub-converter114 // https://github.com/nwillc/vplugin115 alias(libs.plugins.nwillc)116 // https://github.com/ben-manes/gradle-versions-plugin117 alias(libs.plugins.benManes)118 // https://github.com/jk1/Gradle-License-Report119 alias(libs.plugins.licenseReport)120 // https://github.com/gradle-dependency-analyze/gradle-dependency-analyze121 // https://github.com/jaredsburrows/gradle-license-plugin122 // https://github.com/hierynomus/license-gradle-plugin123}124defaultTasks = mutableListOf("compileTestKotlin")125group = "com.acme"126version = "1.0.0"127repositories {128 mavenCentral()129 // https://github.com/spring-projects/spring-framework/wiki/Spring-repository-FAQ130 // https://github.com/spring-projects/spring-framework/wiki/Release-Process131 maven("https://repo.spring.io/release") { mavenContent { releasesOnly() } }132 maven("https://repo.spring.io/milestone") { mavenContent { releasesOnly() } }133 // Snapshots von Spring (auch erforderlich fuer Snapshots von springdoc-openapi)134 //maven("https://repo.spring.io/snapshot") { mavenContent { snapshotsOnly() } }135 // Snapshots von springdoc-openapi136 //maven("https://s01.oss.sonatype.org/content/repositories/snapshots") { mavenContent { snapshotsOnly() } }137 // Snapshots von JaCoCo fuer Java 18138 maven("https://oss.sonatype.org/content/repositories/snapshots") {139 mavenContent { snapshotsOnly() }140 // https://docs.gradle.org/current/userguide/jacoco_plugin.html#sec:jacoco_dependency_management141 content { onlyForConfigurations("jacocoAgent", "jacocoAnt") }142 }143}144/** Konfiguration fuer ktlint */145val ktlintCfg: Configuration by configurations.creating146// https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_separation147dependencies {148 // https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html#sec:bom_import149 // https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-bom/pom.xml150 implementation(platform(libs.kotlinBom))151 //implementation(platform(libs.coroutinesBom))152 // https://snyk.io/vuln/SNYK-JAVA-IONETTY-1042268153 // https://github.com/netty/netty/issues/8537154 implementation(platform(libs.nettyBom))155 implementation(platform(libs.reactorBom))156 //implementation(platform(libs.jacksonBom))157 //implementation(platform(libs.springBom))158 //implementation(platform(libs.springSecurityBom))159 //implementation(platform(libs.junitBom))160 implementation(platform(libs.allureBom))161 implementation(platform(libs.springBootBom))162 implementation(platform(libs.vertxBom))163 implementation(platform(libs.mutinyBom))164 // spring-boot-starter-parent als "Parent POM"165 implementation(platform(libs.springdocOpenapiBom))166 // kotlinx.reflect.lite unterstuetzt nur Namen von Parametern und deren Nullability167 implementation("org.jetbrains.kotlin:kotlin-reflect")168 implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")169 implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")170 // "Starters" enthalten sinnvolle Abhaengigkeiten, die man i.a. benoetigt171 // spring-boot-starter beinhaltet Spring Boot mit Actuator sowie spring-boot-starter-logging mit Logback172 implementation("org.springframework.boot:spring-boot-starter")173 implementation("org.springframework.boot:spring-boot-starter-webflux")174 implementation("org.springframework.boot:spring-boot-starter-tomcat")175 implementation("org.springframework.boot:spring-boot-starter-json")176 implementation("org.springframework.boot:spring-boot-starter-graphql")177 //implementation(libs.springGraphQL)178 // "Spring Boot Starter ist fuer Spring WebMvc" https://github.com/spring-projects/spring-boot/issues/26897179 implementation("org.springframework.hateoas:spring-hateoas")180 implementation("org.springframework.boot:spring-boot-starter-security")181 implementation("org.springframework.security:spring-security-crypto")182 implementation("org.springframework.boot:spring-boot-starter-mail")183 implementation("org.springframework.boot:spring-boot-starter-actuator") {184 // wegen Spring Native185 exclude(group = "io.micrometer", module = "micrometer-core")186 }187 implementation("com.fasterxml.jackson.module:jackson-module-kotlin")188 implementation(libs.bouncycastle)189 implementation(libs.hibernateReactive)190 implementation(libs.mutinyKotlin)191 implementation(libs.mutinyReactor)192 // https://springdoc.org/v2/#swagger-ui-configuration193 // https://github.com/springdoc/springdoc-openapi194 // https://github.com/springdoc/springdoc-openapi-demos/wiki/springdoc-openapi-2.x-migration-guide195 // https://www.baeldung.com/spring-rest-openapi-documentation196 // https://localhost:8080/swagger-ui.html197 implementation("org.springdoc:springdoc-openapi-webflux-ui")198 // referenziert io.vertx:vertx-sql-client, das auch von hibernate-reactive referenziert wird199 implementation("io.vertx:vertx-pg-client")200 //implementation(io.vertx:vertx-mysql-client)201 implementation(libs.yavi)202 // https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties.core.spring.reactor.debug-agent.enabled203 //implementation("io.projectreactor:reactor-tools")204 // https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-devtools205 // https://www.vojtechruzicka.com/spring-boot-devtools206 // NICHT UNTERSTUETZT durch Spring Native207 // runtimeOnly(libs.devtools)208 runtimeOnly(libs.jansi)209 // fuer PostgreSQL-Treiber und SCRAM zur Authentifizierung210 runtimeOnly(libs.scramClient)211 testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test")212 testImplementation(libs.bundles.kotestBundle)213 testImplementation(libs.mockk)214 testImplementation("org.springframework.boot:spring-boot-starter-test") {215 exclude(group = "org.assertj", module = "assertj-core")216 exclude(group = "org.hamcrest", module = "hamcrest")217 exclude(group = "org.mockito", module = "mockito-core")218 exclude(group = "org.mockito", module = "mockito-junit-jupiter")219 exclude(group = "org.skyscreamer", module = "jsonassert")220 exclude(group = "org.xmlunit", module = "xmlunit-core")221 }222 testImplementation(libs.junitPlatformSuiteApi)223 testRuntimeOnly(libs.junitPlatformSuiteEngine)224 testImplementation("org.springframework.security:spring-security-test")225 // https://github.com/pinterest/ktlint#without-a-plugin-for-gradle-kotlin-dsl-buildgradlekts226 ktlintCfg(libs.bundles.ktlint) {227 attributes {228 attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))229 }230 }231 dokkaHtmlPlugin(libs.dokkaHtml)232 // https://youtrack.jetbrains.net/issue/KT-27463233 @Suppress("UnstableApiUsage")234 constraints {235 implementation(libs.annotations)236 //implementation(libs.springGraphQL)237 //implementation(libs.springHateoas)238 //implementation(libs.hibernateCore)239 //implementation(libs.bundles.tomcat)240 //implementation(libs.bundles.graphqlJavaBundle)241 //implementation(libs.graphqlJava)242 implementation(libs.graphqlJavaDataloader)243 implementation(libs.bundles.slf4jBundle)244 //implementation(libs.logback)245 //implementation(libs.springSecurityRsa)246 //implementation(libs.bundles.log4j)247 ktlintCfg(libs.bundles.ktlint)248 }249}250// aktuelle Snapshots laden251//configurations.all {252// resolutionStrategy { cacheChangingModulesFor(0, "seconds") }253//}254allOpen {255 annotation("org.springframework.boot.context.properties.ConfigurationProperties")256 // https://github.com/spring-guides/tut-spring-boot-kotlin#persistence-with-jpa257 annotation("javax.persistence.Entity")258 annotation("javax.persistence.Embeddable")259 annotation("javax.persistence.MappedSuperclass")260}261noArg {262 annotation("org.springframework.boot.context.properties.ConfigurationProperties")263}264sweeney {265 // TODO Java 18 ab 7.5 RC1 https://github.com/gradle/gradle/issues/19283266 enforce(mapOf("type" to "gradle", "expect" to "[7.4,7.4]"))267 // https://devcenter.heroku.com/articles/java-support#specifying-a-java-version268 enforce(mapOf("type" to "jdk", "expect" to "[17.0.2,18]"))269 validate()270}271tasks.compileJava {272 targetCompatibility = libs.versions.javaVersion.get()273}274tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {275 // https://kotlinlang.org/docs/gradle.html#compiler-options276 kotlinOptions {277 apiVersion = "1.7"278 languageVersion = "1.7"279 jvmTarget = libs.versions.javaVersion.get()280 verbose = true281 freeCompilerArgs = listOfNotNull(282 "-Xjsr305=strict",283 "-progressive",284 "-Xsuppress-version-warnings",285 "-Xstring-concat=indy-with-constants"286 // TODO !!!287 //"-Xinline-classes"288 )289 //allWarningsAsErrors = true290 // ggf. wegen Kotlin-Daemon: %TEMP%\kotlin-daemon.* und %LOCALAPPDATA%\kotlin\daemon291 // https://youtrack.jetbrains.com/issue/KT-18300292 // $env:LOCALAPPDATA\kotlin\daemon293 // $env:TEMP\kotlin-daemon.<ZEITSTEMPEL>294 }295}296tasks.bootJar {297 doLast {298 println("")299 println("Aufruf der ausfuehrbaren JAR-Datei:")300 println("java -D'LOG_PATH=./build/log' -D'javax.net.ssl.trustStore=./src/main/resources/truststore.p12' -D'javax.net.ssl.trustStorePassword=zimmermann' -jar build/libs/${archiveFileName.get()} --spring.profiles.default=dev --spring.profiles.active=dev") // ktlint-disable max-line-length301 println("")302 }303}304// https://github.com/paketo-buildpacks/spring-boot305tasks.bootBuildImage {306 // "created 41 years ago" wegen Reproducability: https://medium.com/buildpacks/time-travel-with-pack-e0efd8bf05db307 // default: imageName = "docker.io/${project.name}:${project.version}"308 val username = "juergenzimmermann"309 val tag = System.getProperty("tag") ?: project.version310 imageName = "$username/${project.name}:$tag"311 // https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#build-image.examples.builder-configuration312 // https://github.com/bell-sw/Liberica/releases313 // https://github.com/paketo-buildpacks/bellsoft-liberica/releases314 environment = mapOf(315 //"BP_JVM_VERSION" to "17.*"316 "BP_JVM_VERSION" to "17.0.2"317 //"BPL_JVM_THREAD_COUNT" to "50"318 //"BP_BOOT_NATIVE_IMAGE" to "true",319 // evtl. -H:+TraceClassInitialization320 //"BP_BOOT_NATIVE_IMAGE_BUILD_ARGUMENTS" to """321 // --verbose322 // -H:+ReportExceptionStackTraces323 //""".trimIndent()324 )325 // evtl. -H:+TraceClassInitialization326 // evtl. --initialize-at-build-time fuer Netty327 // Spring Native 0.11: Spring Boot 2.6, GraalVM 21.3, Java 17, Netty (NICHT: Tomcat), Gradle 7.x328 // https://github.com/paketo-buildpacks/spring-boot-native-image329 // https://github.com/paketo-buildpacks/builder330 // https://paketo.io/docs/getting-started/where-do-buildpacks-factor-in331 // https://github.com/spring-projects-experimental/spring-native332 // https://docs.spring.io/spring-native/docs/0.11.0-RC1/reference/htmlsingle/#support-spring-boot333 //builder = "paketobuildpacks/builder:tiny"334 // https://github.com/paketo-buildpacks/java-native-image/releases335 //buildpacks = listOf("gcr.io/paketo-buildpacks/java-native-image:5.12.0")336}337// Fuer Spring Native und logback.xml:338// https://docs.spring.io/spring-native/docs/0.11.0-RC1/reference/htmlsingle/#_starters_requiring_no_special_dependency_management339// https://docs.spring.io/spring-native/docs/0.11.0-RC1/reference/htmlsingle/#spring-aot340// https://github.com/spring-projects-experimental/spring-native/issues/625341// https://github.com/spring-projects/spring-boot/issues/25847342//springAot {343// removeXmlSupport.set(false)344//}345// https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin346// https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#why-is-my-image-created-48-years-ago347jib {348 val debug = System.getProperty("debug") ?: false.toString()349 from {350 // Cache fuer Images und Layers: ${env:LOCALAPPDATA}\Local\Google\Jib\Cache351 // Ein "distroless image" enthaelt keine Package Manager, Shells, usw., sondern nur in der Variante -debug352 // d.h. ca. 250 MB statt ca. 450 MB353 // https://console.cloud.google.com/gcr/images/distroless354 image = if (debug.toBoolean()) {355 "gcr.io/distroless/java17-debian11:debug-nonroot"356 } else {357 "gcr.io/distroless/java17-debian11:nonroot"358 }359 }360 to {361 val username = "juergenzimmermann"362 val tag = System.getProperty("tag") ?: project.version363 image = "$username/${project.name}:$tag"364 if (debug.toBoolean()) {365 image += "-debug"366 }367 }368 container {369 // User "nonroot" Group "nonroot", 1: root370 // siehe /etc/passwd371 user = "65532:65532"372 // Default: com.google.cloud.tools.jib.api.buildplan.ImageFormat.Docker373 //format = com.google.cloud.tools.jib.api.buildplan.ImageFormat.OCI374 //creationTime = "USE_CURRENT_TIMESTAMP"375 // https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#jvm-flags376 jvmFlags = listOf("-Dspring.config.location=classpath:/application.yml")377 }378 skaffold.watch.setExcludes(setOf("extras"))379 // https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin#extended-usage Umgebungsvariable380 // https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin#system-properties381}382tasks.bootRun {383 // "System Properties", z.B. fuer Spring Properties oder fuer slf4j384 val port = System.getProperty("port")385 if (port != null) {386 systemProperty("server.port", port)387 }388 systemProperty("LOG_PATH", "./build/log")389 val hey = System.getProperty("hey")?.toLowerCase() == "true"390 if (hey) {391 systemProperty("APPLICATION_LOGLEVEL", "INFO")392 systemProperty("REQUEST_RESPONSE_LOGLEVEL", "INFO")393 } else {394 systemProperty("APPLICATION_LOGLEVEL", "TRACE")395 }396 args(397 "--spring.profiles.default=dev",398 "--spring.profiles.active=dev",399 "--spring.output.ansi.enabled=ALWAYS",400 "--spring.config.location=classpath:/application.yml"401 // "--spring.devtools.restart.enabled=true",402 // "--spring.devtools.restart.trigger-file=.reloadtrigger"403 )404 // Hotspot Compiler fuer aggressivere Optimierung als der Client-Compiler, aber laengere Startzeit: -server"405 // Remote Debugger: .\gradlew bootRun --debug-jvm -verbose:class -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005406}407tasks.test {408 useJUnitPlatform {409 includeTags = setOf("rest", "graphql", "service")410 //includeTags = setOf("service")411 }412 val fork = System.getProperty("fork") ?: "1"413 maxParallelForks = fork.toInt()414 systemProperty("javax.net.ssl.trustStore", "./src/main/resources/truststore.p12")415 systemProperty("javax.net.ssl.trustStorePassword", "zimmermann")416 systemProperty("junit.platform.output.capture.stdout", true)417 systemProperty("junit.platform.output.capture.stderr", true)418 systemProperty("spring.config.location", "./src/main/resources/application.yml")419 // Tests ohne TLS und ohne HTTP2420 systemProperty("server.ssl.enabled", false)421 systemProperty("server.http2.enabled", false)422 // Umgebungsvariable, z.B. fuer Spring Properties, slf4j oder WebClient423 environment("LOG_PATH", "./build/log")424 environment("APPLICATION_LOGLEVEL", "TRACE")425 // Warning beim Ende der einzelnen Tests unterdruecken426 environment("WEBAPP_CLASS_LOADER_BASE_LOGLEVEL", "ERROR")427 // https://docs.gradle.org/current/userguide/java_testing.html#sec:debugging_java_tests428 // https://www.jetbrains.com/help/idea/run-debug-configuration-junit.html429 // https://docs.gradle.org/current/userguide/java_testing.html#sec:debugging_java_tests430 //debug = true431 //finalizedBy("jacocoTestReport")432}433// https://docs.qameta.io/allure/#_gradle_2434allure {435 version.set(libs.versions.allure.get())436 adapter {437 frameworks {438 junit5 {439 adapterVersion.set(libs.versions.allureJunit.get())440 autoconfigureListeners.set(true)441 enabled.set(true)442 }443 }444 autoconfigure.set(true)445 aspectjWeaver.set(false)446 aspectjVersion.set(libs.versions.aspectjweaver.get())447 }448 //downloadLink = "https://repo1.maven.org/maven2/io/qameta/allure/allure-commandline/${libs.versions.allureCommandline.get()}/allure-commandline-${libs.versions.allureCommandline.get()}.zip"449}450jacoco {451 toolVersion = libs.versions.jacoco.get()452}453// https://docs.gradle.org/current/userguide/task_configuration_avoidance.html454// https://guides.gradle.org/migrating-build-logic-from-groovy-to-kotlin/#configuring-tasks455tasks.getByName<JacocoReport>("jacocoTestReport") {456 reports {457 xml.required.set(true)458 html.required.set(true)459 }460 // afterEvaluate gibt es nur bei getByName<> ("eager"), nicht bei named<> ("lazy")461 // https://docs.gradle.org/5.0/release-notes.html#configuration-avoidance-api-disallows-common-configuration-errors462 afterEvaluate {463 classDirectories.setFrom(464 files(465 classDirectories.files.map {466 fileTree(it) { exclude("**/config/**", "**/entity/**") }467 }468 )469 )470 }471 // https://github.com/gradle/gradle/pull/12626472 dependsOn(tasks.test)473}474// https://ktlint.github.io/#getting-started475// https://android.github.io/kotlin-guides/style.html476// https://kotlinlang.org/docs/reference/coding-conventions.html477// https://www.jetbrains.com/help/idea/code-style-kotlin.html478// https://github.com/android/kotlin-guides/issues/37479// https://github.com/shyiko/ktlint480@Suppress("KDocMissingDocumentation")481val ktlint by tasks.register<JavaExec>("ktlint") {482 classpath = ktlintCfg483 mainClass.set("com.pinterest.ktlint.Main")484 // https://github.com/pinterest/ktlint/blob/master/ktlint/src/main/kotlin/com/pinterest/ktlint/Main.kt485 args = listOfNotNull(486 "--verbose",487 "--experimental",488 "--relative",489 "--color",490 "--reporter=plain",491 "--reporter=checkstyle,output=$buildDir/reports/ktlint.xml",492 "src/**/*.kt"493 )494 description = "Check Kotlin code style."495 group = "verification"496}497tasks.check { dependsOn(ktlint) }498detekt {499 buildUponDefaultConfig = true500 allRules = true501 parallel = true502 config = files(project.rootDir.resolve("extras/detekt.yaml"))503}504tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {505 reports {506 val reportsDir = "$buildDir/reports"507 xml.outputLocation.set(file("$reportsDir/detekt.xml"))508 html.outputLocation.set(file("$reportsDir/detekt.html"))509 txt.required.set(false)510 }511}512// https://github.com/jeremylong/DependencyCheck/blob/master/src/site/markdown/dependency-check-gradle/configuration.md513dependencyCheck {514 scanConfigurations = listOfNotNull("runtimeClasspath")515 suppressionFile = "$projectDir/extras/owasp.xml"516 data(517 closureOf<org.owasp.dependencycheck.gradle.extension.DataExtension> {518 directory = "C:/Zimmermann/owasp-dependency-check"519 username = "dc"520 password = "p"521 }522 )523 analyzedTypes = listOfNotNull("jar")524 analyzers(525 closureOf<org.owasp.dependencycheck.gradle.extension.AnalyzerExtension> {526 // nicht benutzte Analyzer527 assemblyEnabled = false528 autoconfEnabled = false529 bundleAuditEnabled = false530 cmakeEnabled = false531 cocoapodsEnabled = false532 composerEnabled = false533 golangDepEnabled = false534 golangModEnabled = false535 nodeEnabled = false536 nugetconfEnabled = false537 nuspecEnabled = false538 pyDistributionEnabled = false539 pyPackageEnabled = false540 rubygemsEnabled = false541 swiftEnabled = false542 nodeAudit(closureOf<org.owasp.dependencycheck.gradle.extension.NodeAuditExtension> { enabled = true })543 retirejs(closureOf<org.owasp.dependencycheck.gradle.extension.RetireJSExtension> { enabled = true })544 //ossIndex(closureOf<org.owasp.dependencycheck.gradle.extension.OssIndexExtension> { enabled = true })545 }546 )547 format = org.owasp.dependencycheck.reporting.ReportGenerator.Format.ALL548}549snyk {550 setArguments("--configuration-matching=implementation|runtimeOnly")551 setSeverity("low")552 setApi("40df2078-e1a3-4f28-b913-e2babbe427fd")553}554// SVG-Dateien von AsciidoctorPdf fuer Dokka umkopieren555@Suppress("KDocMissingDocumentation")556val copySvg by tasks.register<Copy>("copySvg") {557 from("$buildDir/docs/asciidocPdf")558 include("*.svg")559 into("$buildDir/dokka/html/images")560 dependsOn("asciidoctorPdf")561}562// https://github.com/Kotlin/dokka/blob/master/docs/src/doc/docs/user_guide/gradle/usage.md563tasks.dokkaHtml {564 // default: $USER_HOME/.cache/dokka565 cacheRoot.set(file("$buildDir/dokka/cache"))566 dokkaSourceSets {567 configureEach {568 includes.from("Module.md")569 reportUndocumented.set(true)570 jdkVersion.set(libs.versions.javaVersion.get().toInt())571 noStdlibLink.set(true)572 noJdkLink.set(true)573 }574 }575 failOnWarning.set(true)576 dependsOn("createDokkaCacheDirectory", copySvg)577}578tasks.register("createDokkaCacheDirectory") {579 doLast { mkdir("$buildDir/dokka/cache") }580}581tasks.asciidoctor {582 asciidoctorj {583 setVersion(libs.versions.asciidoctorj.get())584 //requires("asciidoctor-diagram")585 modules {586 diagram.use()587 diagram.setVersion(libs.versions.asciidoctorjDiagram.get())588 }589 }590 val separator = System.getProperty("file.separator")591 setBaseDir(file("extras${separator}doc"))592 setSourceDir(file("extras${separator}doc"))593 //setOutputDir(file("$buildDir/docs/asciidoc"))594 logDocuments = true595 // https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/597#issuecomment-844352804596 inProcess = org.asciidoctor.gradle.base.process.ProcessMode.JAVA_EXEC597 forkOptions {598 jvmArgs("--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED")599 }600 doLast {601 println("Das Entwicklerhandbuch ist in $buildDir${separator}extras${separator}docs${separator}asciidoc${separator}entwicklerhandbuch.html") // ktlint-disable max-line-length602 }603}604tasks.asciidoctorPdf {605 asciidoctorj {606 setVersion(libs.versions.asciidoctorj.get())607 modules {608 diagram.use()609 diagram.setVersion(libs.versions.asciidoctorjDiagram.get())610 pdf.setVersion(libs.versions.asciidoctorjPdf.get())611 }612 }613 val separator = System.getProperty("file.separator")614 setBaseDir(file("extras${separator}doc"))615 setSourceDir(file("extras${separator}doc"))616 attributes(mapOf("pdf-page-size" to "A4"))617 logDocuments = true618 // https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/597#issuecomment-844352804619 inProcess = org.asciidoctor.gradle.base.process.ProcessMode.JAVA_EXEC620 forkOptions {621 jvmArgs("--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED")622 }623 doLast {624 println("Das Entwicklerhandbuch ist in $buildDir${separator}docs${separator}asciidocPdf${separator}entwicklerhandbuch.pdf") // ktlint-disable max-line-length625 }626}627// jig {628// // Output all elements regardless of package629// modelPattern = ".+"630// // Output only package related diagram and business rule list631// //documentTypes = listOf("PackageRelationDiagram", "BusinessRuleList")632// }633licenseReport {634 configurations = arrayOf("runtimeClasspath")635}636tasks.dependencyUpdates {637 checkConstraints = true638}639idea {640 module {641 isDownloadJavadoc = true642 }643}...

Full Screen

Full Screen

active.kt

Source:active.kt Github

copy

Full Screen

...33 */34fun Expression?.isActive(tags: Set<Tag>): Boolean {35 // everything is always active when no tag expression is provided36 if (this == null) return true37 return evaluate(tags, this)38}39private fun evaluate(tags: Set<Tag>, expression: Expression): Boolean {40 return when (expression) {41 is Expression.Or -> evaluate(tags, expression.left) || evaluate(tags, expression.right)42 is Expression.And -> evaluate(tags, expression.left) && evaluate(tags, expression.right)43 is Expression.Not -> !evaluate(tags, expression.expr)44 is Expression.Identifier -> tags.map { it.name }.contains(expression.ident)45 }46}...

Full Screen

Full Screen

evaluate

Using AI Code Generation

copy

Full Screen

1 fun testTags() {2 val tags = Tags("a", "b", "c")3 assertTrue(tags.evaluate("a"))4 assertTrue(tags.evaluate("b"))5 assertTrue(tags.evaluate("c"))6 assertTrue(tags.evaluate("a,b"))7 assertTrue(tags.evaluate("a,b,c"))8 assertFalse(tags.evaluate("x"))9 assertFalse(tags.evaluate("a,x"))10 assertFalse(tags.evaluate("x,y"))11 assertFalse(tags.evaluate("x,y,z"))12 }13 fun testTags2() {14 val tags = Tags("a", "b", "c")15 assertTrue(tags.evaluate("a"))16 assertTrue(tags.evaluate("b"))17 assertTrue(tags.evaluate("c"))18 assertTrue(tags.evaluate("a,b"))19 assertTrue(tags.evaluate("a,b,c"))20 assertFalse(tags.evaluate("x"))21 assertFalse(tags.evaluate("a,x"))22 assertFalse(tags.evaluate("x,y"))23 assertFalse(tags.evaluate("x,y,z"))24 }25}

Full Screen

Full Screen

evaluate

Using AI Code Generation

copy

Full Screen

1val activeTags = ActiveTagFilter().evaluate()2val excludedTags = ExcludedTagFilter().evaluate()3val includeTags = IncludeTagFilter().evaluate()4val excludedTags = ExcludedTagFilter().evaluate()5val includeTags = IncludeTagFilter().evaluate()6val excludedTags = ExcludedTagFilter().evaluate()7val includeTags = IncludeTagFilter().evaluate()8val excludedTags = ExcludedTagFilter().evaluate()9val includeTags = IncludeTagFilter().evaluate()10val excludedTags = ExcludedTagFilter().evaluate()11val includeTags = IncludeTagFilter().evaluate()12val excludedTags = ExcludedTagFilter().evaluate()13val includeTags = IncludeTagFilter().evaluate()14val excludedTags = ExcludedTagFilter().evaluate()15val includeTags = IncludeTagFilter().evaluate()16val excludedTags = ExcludedTagFilter().evaluate()

Full Screen

Full Screen

evaluate

Using AI Code Generation

copy

Full Screen

1val activeTags = ActiveTags(listOf("fast","slow"))2val result = activeTags.evaluate("fast","slow")3val result2 = activeTags.evaluate("fast","slow","medium")4val result3 = activeTags.evaluate("fast")5val result4 = activeTags.evaluate("slow")6val result5 = activeTags.evaluate("medium")7val result6 = activeTags.evaluate("fast","medium")8val result7 = activeTags.evaluate("slow","medium")9val result8 = activeTags.evaluate("fast","slow","medium")10val result9 = activeTags.evaluate("fast","slow","medium","slow")11val result10 = activeTags.evaluate("fast","slow","medium","slow","slow")12val result11 = activeTags.evaluate("fast","slow","medium","slow","slow","medium")13val result12 = activeTags.evaluate("fast","slow","medium","slow","slow","medium","medium")14val result13 = activeTags.evaluate("fast","slow","medium","slow","slow","medium","medium","fast")15val result14 = activeTags.evaluate("fast","slow","medium","slow","slow","medium","medium","fast","slow")16val result15 = activeTags.evaluate("fast","slow","medium","slow","slow","medium","medium","fast","slow","medium")17val result16 = activeTags.evaluate("fast","slow","medium","slow","slow","medium","medium","fast","slow","medium","fast")18val result17 = activeTags.evaluate("fast","slow","medium","slow","slow","medium","medium","fast","slow","medium","fast","slow")19val result18 = activeTags.evaluate("fast","slow","medium","slow","slow","medium","medium","fast","slow","medium","fast","slow","medium")20val result19 = activeTags.evaluate("fast","slow","medium","slow","slow

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Kotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in active

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful