Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLI-1566 JaCoCo on UI tests #1150

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
4 changes: 3 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
slack_notification_script: |
.cirrus/slack-notification.sh

validate_task:

Check warning on line 117 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L117

task "validate" depends on task "build", but their only_if conditions are different

Check warning on line 117 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L117

task "validate" depends on task "build", but their only_if conditions are different
# name: "Run UTs and trigger SonarQube analysis"
depends_on:
- build
Expand All @@ -140,7 +140,7 @@
slack_notification_script: |
.cirrus/slack-notification.sh

validate_windows_task:

Check warning on line 143 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L143

task "validate_windows" depends on task "build", but their only_if conditions are different

Check warning on line 143 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L143

task "validate_windows" depends on task "build", but their only_if conditions are different
# name: "Run unit tests on Windows"
depends_on:
- build
Expand Down Expand Up @@ -209,7 +209,7 @@
slack_notification_script: |
.cirrus/slack-notification.sh

qa_task:

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different

Check warning on line 212 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L212

task "qa" depends on task "build", but their only_if conditions are different
# name: "Run ITs"
depends_on:
- build
Expand Down Expand Up @@ -368,7 +368,7 @@
run_its_script: |
echo "Run ITs on ${IDEA_VERSION}"
source .cirrus/use-gradle-wrapper.sh
gradle :its:check --stacktrace -i -PijVersion=${IDEA_VERSION} -PslPluginDirectory=${CIRRUS_WORKING_DIR}/staged-plugin
gradle :its:check --stacktrace -i -PijVersion=${IDEA_VERSION} -PslPluginDirectory=${CIRRUS_WORKING_DIR}/staged-plugin sonar
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
always:
stop_recording_script: |
Expand All @@ -381,6 +381,8 @@
path: "${CIRRUS_WORKING_DIR}/recording_${IDEA_VERSION}.mp4"
log_artifacts:
path: "its/build/idea-sandbox/system/log"
reportss_artifacts:
path: "**/reports/**/*"
on_failure:
xvfb_log_artifacts:
path: "${CIRRUS_WORKING_DIR}/Xvfb.out"
Expand All @@ -392,7 +394,7 @@
slack_notification_script: |
.cirrus/slack-notification.sh

inspect_orchestrator_cache_task:

Check warning on line 397 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L397

task "inspect_orchestrator_cache" depends on task "build", but their only_if conditions are different

Check warning on line 397 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L397

task "inspect_orchestrator_cache" depends on task "build", but their only_if conditions are different
<<: *ONLY_PR_AND_MAINTAINED_BRANCHES
depends_on: build
eks_container:
Expand Down Expand Up @@ -436,7 +438,7 @@
slack_notification_script: |
.cirrus/slack-notification.sh

promote_task:

Check warning on line 441 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L441

task "promote" depends on task "mend_scan", but their only_if conditions are different

Check warning on line 441 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L441

task "promote" depends on task "build", but their only_if conditions are different

Check warning on line 441 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L441

task "promote" depends on task "mend_scan", but their only_if conditions are different

Check warning on line 441 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L441

task "promote" depends on task "build", but their only_if conditions are different
depends_on:
- build
- validate
Expand Down
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ allprojects {
}
}


tasks.cyclonedxBom {
setIncludeConfigs(listOf("runtimeClasspath", "sqplugins_deps"))
inputs.files(configurations.runtimeClasspath, configurations.archives.get())
Expand Down Expand Up @@ -228,7 +227,6 @@ dependencies {
}

tasks {

fun copyPlugins(destinationDir: File, pluginName: Property<String>) {
copy {
from(project.configurations["sqplugins"])
Expand Down
28 changes: 27 additions & 1 deletion its/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("org.jetbrains.intellij")
kotlin("jvm")
jacoco
}

group = "org.sonarsource.sonarlint.intellij.its"
Expand Down Expand Up @@ -46,6 +47,11 @@ tasks.test {
}
}
testLogging.showStandardStreams = true

// we need the coverage from Idea process, not from test task
configure<JacocoTaskExtension> {
isEnabled = false
}
}

license {
Expand Down Expand Up @@ -76,11 +82,26 @@ intellij {
if (!project.hasProperty("slPluginDirectory")) {
plugins.set(listOf(rootProject))
}
instrumentCode.set(false)
}

val runIdeDirectory: String by project

val uiTestsCoverageReport = tasks.register<JacocoReport>("uiTestsCoverageReport") {
executionData(tasks.runIdeForUiTests.get())
sourceSets(sourceSets.main.get())
classDirectories.setFrom(files("../build/instrumented/instrumentCode"))

reports {
xml.required.set(true)
}
}

jacoco {
applyTo(tasks.runIdeForUiTests.get())
}



tasks.runIdeForUiTests {
systemProperty("sonarlint.internal.sonarcloud.url", "https://sc-staging.io")
systemProperty("sonarlint.internal.sonarcloud.websocket.url", "wss://events-api.sc-staging.io/")
Expand All @@ -104,4 +125,9 @@ tasks.runIdeForUiTests {
}
}
}
configure<JacocoTaskExtension> {
isIncludeNoLocationClasses = true
excludes = listOf("jdk.internal.*")
}
finalizedBy(uiTestsCoverageReport)
}
18 changes: 18 additions & 0 deletions its/src/test/kotlin/org/sonarlint/intellij/its/BaseUiTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
package org.sonarlint.intellij.its

import com.intellij.remoterobot.RemoteRobot
import com.intellij.remoterobot.steps.CommonSteps
import com.intellij.remoterobot.utils.keyboard
import java.awt.event.KeyEvent.VK_ALT
import java.awt.event.KeyEvent.VK_F4
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.extension.ExtendWith
import org.junit.jupiter.api.fail
Expand Down Expand Up @@ -101,6 +106,19 @@ open class BaseUiTest {
it.close()
}
}

private val steps = CommonSteps(remoteRobot)

@JvmStatic
@AfterAll
fun afterAll() {
steps.invokeAction("Exit")
remoteRobot.idea {
keyboard {
hotKey(VK_ALT, VK_F4)
}
}
}
}


Expand Down
Loading