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

Kotest CI result 업로드 #137

Merged
merged 10 commits into from
Nov 21, 2023
2 changes: 1 addition & 1 deletion .github/workflows/android-pull-request-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
echo "$DEBUG_KEYSTORE" | base64 -d > debug.keystore
echo "$KEYSTORE_PROPERTIES" > keystore.properties
echo "$LOCAL_PROPERTIES" > local.properties
./gradlew testDebugUnitTest --stacktrace
./gradlew debugUnitTest --stacktrace

- name: Publish Test Results
if: always()
Expand Down
16 changes: 10 additions & 6 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ plugins {
alias(libs.plugins.navigation.safe.args) apply false
}

tasks.register<Test>("test") {
useJUnitPlatform()
reports {
junitXml.required.set(false)
}
systemProperty("gradle.build.dir", project.buildDir)

tasks.register<Exec>("domainUnitTest") {
commandLine = listOf("gradle", "core:domain:test")
}


tasks.register<Exec>("debugUnitTest") {
dependsOn("domainUnitTest")
commandLine = listOf("gradle", "testDebugUnitTest")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 혹시 domain의 test만 돌아가지 않을까?
:core:domain 위치에서 testDebugUnitTest를 실행하면 부모의 testDebugUnitTest는 안 돌아갈 거 같아서!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUILD SUCCESSFUL in 53s
167 actionable tasks: 162 executed, 5 up-to-date

기존에 testUnitDebugTest 와 동일하게 다른 Task test도 돌아가는거 확인했습니다~

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 여기가 루트구나

}


true // Needed to make the Suppress annotation work for the plugins block
8 changes: 8 additions & 0 deletions android/core/domain/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ tasks.withType<Test>().configureEach {
useJUnitPlatform()
}

tasks.getByName<Test>("test") {
useJUnitPlatform()
reports {
junitXml.required.set(false)
}
systemProperty("gradle.build.dir", project.buildDir)
}

dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotest.runner)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.ohdodok.catchytape.core.domain.signup
package com.ohdodok.catchytape.core.domain

import io.kotest.core.config.AbstractProjectConfig
import io.kotest.core.extensions.Extension
import io.kotest.extensions.junitxml.JunitXmlReporter

class TestConfig : AbstractProjectConfig() {
class KoTestConfig : AbstractProjectConfig() {

override fun extensions(): List<Extension> = listOf(
JunitXmlReporter(
includeContainers = false, // don't write out status for all tests
useTestPathAsName = true, // use the full test path (ie, includes parent test names)
outputDir = "test-results/excludeContainers"
outputDir = "../build/test-results"
)
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ohdodok.catchytape.core.domain

import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe

class SampleTest : FunSpec({

test("test sample 1") {
1 + 2 shouldBe 3
}

test("test sample 2") {
3 + 4 shouldBe 7
}

test("test sample 3") {
3 + 7 shouldBe 10
}

})