From 3a01e715b70903d703f107ac8f380fe2a6c50715 Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Sat, 21 Dec 2024 09:48:21 +0900 Subject: [PATCH] =?UTF-8?q?[Feat/#457]=20allrue=20=ED=99=98=EA=B2=BD=20?= =?UTF-8?q?=EA=B5=AC=EC=84=B1=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: allure 의존성 설정 * feat: AllureKoTestConfig 구현 * refactor: allure 문서화를 위한 어노테이션 추가 * refactor: docs 액션에서 allure 문서 배포하도록 수정 --- .github/workflows/docs.yml | 56 ++++++++++--------- .../com/few/api/config/AllureKoTestConfig.kt | 9 +++ .../web/controller/ApiControllerTestSpec.kt | 2 + .../controller/AdminApiControllerTest.kt | 8 +++ .../controller/ArticleApiControllerTest.kt | 6 ++ .../article/usecase/ReadArticleUseCaseTest.kt | 6 ++ .../log/controller/ApiLogApiControllerTest.kt | 4 ++ .../controller/MemberApiControllerTest.kt | 5 ++ .../member/usecase/SaveMemberUseCaseTest.kt | 6 ++ .../domain/member/usecase/TokenUseCaseTest.kt | 6 ++ .../controller/ProblemApiControllerTest.kt | 7 +++ .../usecase/BrowseProblemsUseCaseTest.kt | 6 ++ .../BrowseUndoneProblemsUseCaseTest.kt | 6 ++ .../usecase/CheckProblemUseCaseTest.kt | 6 ++ .../problem/usecase/ReadProblemUseCaseTest.kt | 6 ++ .../SubscriptionApiControllerTest.kt | 10 ++++ .../BrowseSubscribeWorkbooksUseCaseTest.kt | 6 ++ .../usecase/SubscribeWorkbookUseCaseTest.kt | 6 ++ .../usecase/UnsubscribeAllUseCaseTest.kt | 6 ++ .../usecase/UnsubscribeWorkbookUseCaseTest.kt | 6 ++ .../model/WorkbookSubscriptionHistoryTest.kt | 4 ++ .../WorkBookArticleApiControllerTest.kt | 4 ++ .../controller/WorkBookApiControllerTest.kt | 6 ++ .../usecase/BrowseWorkbooksUseCaseTest.kt | 6 ++ .../usecase/ReadWorkbookUseCaseTest.kt | 6 ++ .../AuthMainViewWorkbookOrderDelegatorTest.kt | 4 ++ build.gradle.kts | 4 ++ buildSrc/src/main/kotlin/DependencyVersion.kt | 3 +- 28 files changed, 184 insertions(+), 26 deletions(-) create mode 100644 api/src/test/kotlin/com/few/api/config/AllureKoTestConfig.kt diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c5ff5ac3c..751eed8b0 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,4 +1,4 @@ -name: Build and Publish Dokka Documentation +name: Build and Publish Allure Documentation on: pull_request: @@ -8,40 +8,46 @@ on: permissions: write-all jobs: - dokka: + docs: runs-on: ubuntu-latest steps: - # 1. Checkout the code - uses: actions/checkout@v4 - # 2. Set up JDK - - name: Set up JDK - uses: actions/setup-java@v4 + - name: Set up JDK 18 + uses: actions/setup-java@v3 with: - distribution: zulu - java-version: 17 + java-version: '18' + distribution: 'temurin' - # 3. Run dokkaHtmlMultiModule - - name: Generate Dokka Documentation - run: ./gradlew dokkaHtmlMultiModule + - name: Grant execute permission for gradlew + run: chmod +x gradlew - # 4. Checkout gh-pages branch to publish documentation - - name: Checkout gh-pages - uses: actions/checkout@v4 + - name: Jooq Code Generation + run: | + ./gradlew jooqCodegenAll + - name: Generate Allure Results + run: ./gradlew api:test + + - name: Load test report history + uses: actions/checkout@v3 + if: always() + continue-on-error: true with: - ref: gh-pages # Use the `gh-pages` branch - path: gh-pages # Specify the path where `gh-pages` branch will be checked out + ref: gh-pages + path: gh-pages - # 5. Copy generated documentation to gh-pages directory - - name: Copy Dokka Documentation - run: | - rm -rf gh-pages/* # Clear existing files - cp -R build/dokka/htmlMultiModule/* gh-pages/ # Copy the newly generated documentation + - name: Build test report + uses: simple-elf/allure-report-action@v1.7 + if: always() + with: + gh_pages: gh-pages + allure_history: allure-history + allure_results: api/build/allure-results - # 6. Publish documentation to GitHub Pages - - name: Publish Documentation - uses: peaceiris/actions-gh-pages@v4 + - name: Publish test report + uses: peaceiris/actions-gh-pages@v3 + if: always() with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_branch: gh-pages - publish_dir: gh-pages + publish_dir: allure-history diff --git a/api/src/test/kotlin/com/few/api/config/AllureKoTestConfig.kt b/api/src/test/kotlin/com/few/api/config/AllureKoTestConfig.kt new file mode 100644 index 000000000..63f325c4b --- /dev/null +++ b/api/src/test/kotlin/com/few/api/config/AllureKoTestConfig.kt @@ -0,0 +1,9 @@ +package com.few.api.config + +import io.kotest.core.config.AbstractProjectConfig +import io.kotest.core.extensions.Extension +import io.kotest.extensions.allure.AllureTestReporter + +class AllureKoTestConfig : AbstractProjectConfig() { + override fun extensions(): List = listOf(AllureTestReporter()) +} \ No newline at end of file diff --git a/api/src/test/kotlin/com/few/api/config/web/controller/ApiControllerTestSpec.kt b/api/src/test/kotlin/com/few/api/config/web/controller/ApiControllerTestSpec.kt index 50635623f..43179d351 100644 --- a/api/src/test/kotlin/com/few/api/config/web/controller/ApiControllerTestSpec.kt +++ b/api/src/test/kotlin/com/few/api/config/web/controller/ApiControllerTestSpec.kt @@ -26,6 +26,7 @@ import com.few.api.domain.workbook.article.usecase.ReadWorkBookArticleUseCase import com.few.api.domain.workbook.controller.WorkBookController import com.few.api.domain.workbook.usecase.BrowseWorkbooksUseCase import com.few.api.domain.workbook.usecase.ReadWorkbookUseCase +import io.qameta.allure.Epic import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs @@ -41,6 +42,7 @@ import security.TokenResolver import security.config.SecurityConfig import web.config.WebConfig +@Epic("V1.0 API") @ActiveProfiles(value = ["test", "new"]) @AutoConfigureRestDocs @AutoConfigureMockMvc(addFilters = false) diff --git a/api/src/test/kotlin/com/few/api/domain/admin/controller/AdminApiControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/admin/controller/AdminApiControllerTest.kt index 70aacb194..ffa9ca9b0 100644 --- a/api/src/test/kotlin/com/few/api/domain/admin/controller/AdminApiControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/admin/controller/AdminApiControllerTest.kt @@ -7,6 +7,8 @@ import com.few.api.config.web.controller.ApiControllerTestSpec import com.few.api.domain.admin.controller.request.* import com.few.api.domain.admin.usecase.dto.* import com.few.api.domain.common.vo.CategoryType +import io.qameta.allure.Feature +import io.qameta.allure.Story import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.doNothing @@ -23,6 +25,7 @@ import web.helper.* import java.net.URL import java.util.stream.IntStream +@Feature("Admin API") class AdminApiControllerTest : ApiControllerTestSpec() { companion object { private const val BASE_URL = "/api/v1/admin" @@ -31,6 +34,7 @@ class AdminApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[POST] /api/v1/admin/workbooks") + @Story("[POST] /api/v1/admin/workbooks") fun addWorkbook() { // given val api = "AddWorkbook" @@ -85,6 +89,7 @@ class AdminApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[POST] /api/v1/admin/articles") + @Story("[POST] /api/v1/admin/articles") fun addArticle() { // given val api = "AddArticle" @@ -182,6 +187,7 @@ class AdminApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[POST] /api/v1/admin/relations/articles") + @Story("[POST] /api/v1/admin/relations/articles") fun mapArticle() { // given val api = "MapArticle" @@ -230,6 +236,7 @@ class AdminApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[POST] /api/v1/admin/utilities/conversion/content") + @Story("[POST] /api/v1/admin/utilities/conversion/content") fun convertContent() { // given val api = "ConvertContent" @@ -281,6 +288,7 @@ class AdminApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[POST] /api/v1/utilities/conversion/image") + @Story("[POST] /api/v1/utilities/conversion/image") fun putImage() { // given val api = "PutImage" diff --git a/api/src/test/kotlin/com/few/api/domain/article/controller/ArticleApiControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/article/controller/ArticleApiControllerTest.kt index e4d0d79e2..69c2a1d16 100644 --- a/api/src/test/kotlin/com/few/api/domain/article/controller/ArticleApiControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/article/controller/ArticleApiControllerTest.kt @@ -7,6 +7,8 @@ import com.epages.restdocs.apispec.Schema import com.few.api.config.web.controller.ApiControllerTestSpec import com.few.api.domain.article.usecase.dto.* import com.few.api.domain.common.vo.CategoryType +import io.qameta.allure.Feature +import io.qameta.allure.Story import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` @@ -21,6 +23,7 @@ import java.net.URL import java.time.LocalDateTime import java.util.stream.IntStream +@Feature("Article API") class ArticleApiControllerTest : ApiControllerTestSpec() { companion object { private const val BASE_URL = "/api/v1/articles" @@ -32,6 +35,7 @@ class ArticleApiControllerTest : ApiControllerTestSpec() { */ @Test @DisplayName("[GET] /api/v1/articles/{articleId}") + @Story("[GET] /api/v1/articles/{articleId}") fun readArticle() { // given val api = "ReadArticle" @@ -122,6 +126,7 @@ class ArticleApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[GET] /api/v1/articles?prevArticleId={optional}?categoryCd={optional}") + @Story("[GET] /api/v1/articles?prevArticleId={optional}?categoryCd={optional}") fun readArticles() { // given val api = "ReadArticles" @@ -224,6 +229,7 @@ class ArticleApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[GET] /api/v1/articles/categories") + @Story("[GET] /api/v1/articles/categories") fun browseArticleCategories() { // given val api = "browseArticleCategories" diff --git a/api/src/test/kotlin/com/few/api/domain/article/usecase/ReadArticleUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/article/usecase/ReadArticleUseCaseTest.kt index b5ab6c1b6..7831a3cdc 100644 --- a/api/src/test/kotlin/com/few/api/domain/article/usecase/ReadArticleUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/article/usecase/ReadArticleUseCaseTest.kt @@ -15,10 +15,16 @@ import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.BehaviorSpec import io.kotest.matchers.shouldBe import io.mockk.* +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story import org.springframework.context.ApplicationEventPublisher import java.net.URL import java.time.LocalDateTime +@Epic("V1.0 UseCase") +@Feature("Article") +@Story("ReadArticle") class ReadArticleUseCaseTest : BehaviorSpec({ val log = KotlinLogging.logger {} diff --git a/api/src/test/kotlin/com/few/api/domain/log/controller/ApiLogApiControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/log/controller/ApiLogApiControllerTest.kt index 473a22890..9890cd800 100644 --- a/api/src/test/kotlin/com/few/api/domain/log/controller/ApiLogApiControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/log/controller/ApiLogApiControllerTest.kt @@ -6,6 +6,8 @@ import com.epages.restdocs.apispec.Schema import com.few.api.config.web.controller.ApiControllerTestSpec import com.few.api.domain.log.controller.request.ApiLogRequest import com.few.api.domain.log.dto.AddApiLogUseCaseIn +import io.qameta.allure.Feature +import io.qameta.allure.Story import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito @@ -18,6 +20,7 @@ import web.helper.toIdentifier import web.helper.toRequestSchema import web.helper.toResponseSchema +@Feature("API Log API") class ApiLogApiControllerTest : ApiControllerTestSpec() { companion object { private const val BASE_URL = "/api/v1/logs" @@ -26,6 +29,7 @@ class ApiLogApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[POST] /api/v1/logs") + @Story("[POST] /api/v1/logs") fun addApiLog() { // Given val api = "addApiLog" diff --git a/api/src/test/kotlin/com/few/api/domain/member/controller/MemberApiControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/member/controller/MemberApiControllerTest.kt index 2d3979d73..8280641dc 100644 --- a/api/src/test/kotlin/com/few/api/domain/member/controller/MemberApiControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/member/controller/MemberApiControllerTest.kt @@ -11,6 +11,8 @@ import com.few.api.domain.member.usecase.dto.SaveMemberUseCaseIn import com.few.api.domain.member.usecase.dto.SaveMemberUseCaseOut import com.few.api.domain.member.usecase.dto.TokenUseCaseIn import com.few.api.domain.member.usecase.dto.TokenUseCaseOut +import io.qameta.allure.Feature +import io.qameta.allure.Story import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` @@ -23,6 +25,7 @@ import web.description.Description import web.helper.* @Suppress("ktlint:standard:property-naming", "ktlint:standard:max-line-length") +@Feature("Member API") class MemberApiControllerTest : ApiControllerTestSpec() { companion object { private const val BASE_URL = "/api/v1/members" @@ -31,6 +34,7 @@ class MemberApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[POST] /api/v1/members") + @Story("[POST] /api/v1/members") fun saveMember() { // given val api = "SaveMember" @@ -80,6 +84,7 @@ class MemberApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[POST] /api/v1/members/token") + @Story("[POST] /api/v1/members/token") fun token() { // given val api = "Token" diff --git a/api/src/test/kotlin/com/few/api/domain/member/usecase/SaveMemberUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/member/usecase/SaveMemberUseCaseTest.kt index ff771991f..911730669 100644 --- a/api/src/test/kotlin/com/few/api/domain/member/usecase/SaveMemberUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/member/usecase/SaveMemberUseCaseTest.kt @@ -13,9 +13,15 @@ import io.kotest.matchers.shouldBe import io.mockk.every import io.mockk.mockk import io.mockk.verify +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story import org.mockito.ArgumentMatchers.any import security.encryptor.IdEncryptor +@Epic("V1.0 UseCase") +@Feature("Member") +@Story("SaveMember") class SaveMemberUseCaseTest : BehaviorSpec({ lateinit var memberDao: MemberDao diff --git a/api/src/test/kotlin/com/few/api/domain/member/usecase/TokenUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/member/usecase/TokenUseCaseTest.kt index 8323b1c07..feacaccc6 100644 --- a/api/src/test/kotlin/com/few/api/domain/member/usecase/TokenUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/member/usecase/TokenUseCaseTest.kt @@ -11,11 +11,17 @@ import io.kotest.matchers.shouldBe import io.mockk.every import io.mockk.mockk import io.mockk.verify +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story import security.AuthToken import security.TokenGenerator import security.TokenResolver import security.encryptor.IdEncryptor +@Epic("V1.0 UseCase") +@Feature("Member") +@Story("Token") class TokenUseCaseTest : BehaviorSpec({ lateinit var tokenGenerator: TokenGenerator diff --git a/api/src/test/kotlin/com/few/api/domain/problem/controller/ProblemApiControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/controller/ProblemApiControllerTest.kt index b167457a0..977ab1fec 100644 --- a/api/src/test/kotlin/com/few/api/domain/problem/controller/ProblemApiControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/controller/ProblemApiControllerTest.kt @@ -7,6 +7,8 @@ import com.epages.restdocs.apispec.Schema import com.few.api.config.web.controller.ApiControllerTestSpec import com.few.api.domain.problem.controller.request.CheckProblemRequest import com.few.api.domain.problem.usecase.dto.* +import io.qameta.allure.Feature +import io.qameta.allure.Story import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` @@ -20,6 +22,7 @@ import web.description.Description import web.helper.* @Suppress("ktlint:standard:max-line-length") +@Feature("Problem API") class ProblemApiControllerTest : ApiControllerTestSpec() { companion object { private const val BASE_URL = "/api/v1/problems" @@ -28,6 +31,7 @@ class ProblemApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[GET] /api/v1/problems?articleId=") + @Story("[GET] /api/v1/problems?articleId=") fun browseProblems() { // given val api = "BrowseProblems" @@ -78,6 +82,7 @@ class ProblemApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[GET] /api/v1/problems/{problemId}") + @Story("[GET] /api/v1/problems/{problemId}") fun readProblem() { // given val api = "ReadProblem" @@ -144,6 +149,7 @@ class ProblemApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[POST] /api/v1/problems/{problemId}") + @Story("[POST] /api/v1/problems/{problemId}") fun checkProblem() { // given val api = "CheckProblem" @@ -203,6 +209,7 @@ class ProblemApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[GET] /api/v1/problems/unsubmitted") + @Story("[GET] /api/v1/problems/unsubmitted") fun browseUndoneProblems() { // given val api = "BrowseUndoneProblems" diff --git a/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCaseTest.kt index 8e3af2159..0f483b04a 100644 --- a/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCaseTest.kt @@ -9,7 +9,13 @@ import io.kotest.matchers.shouldBe import io.mockk.every import io.mockk.mockk import io.mockk.verify +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story +@Epic("V1.0 UseCase") +@Feature("Problem") +@Story("BrowseProblems") class BrowseProblemsUseCaseTest : BehaviorSpec({ diff --git a/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseUndoneProblemsUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseUndoneProblemsUseCaseTest.kt index dc133ccdd..9c630a57f 100644 --- a/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseUndoneProblemsUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseUndoneProblemsUseCaseTest.kt @@ -13,7 +13,13 @@ import io.kotest.core.spec.style.BehaviorSpec import io.mockk.every import io.mockk.mockk import io.mockk.verify +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story +@Epic("V1.0 UseCase") +@Feature("Problem") +@Story("BrowseUndoneProblems") class BrowseUndoneProblemsUseCaseTest : BehaviorSpec({ lateinit var problemDao: ProblemDao diff --git a/api/src/test/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCaseTest.kt index 7d3899618..3243301a5 100644 --- a/api/src/test/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCaseTest.kt @@ -10,7 +10,13 @@ import io.kotest.matchers.shouldBe import io.mockk.every import io.mockk.mockk import io.mockk.verify +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story +@Epic("V1.0 UseCase") +@Feature("Problem") +@Story("CheckProblem") class CheckProblemUseCaseTest : BehaviorSpec({ diff --git a/api/src/test/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCaseTest.kt index 3fd9704bf..259917cda 100644 --- a/api/src/test/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCaseTest.kt @@ -12,8 +12,14 @@ import io.kotest.matchers.shouldBe import io.mockk.every import io.mockk.mockk import io.mockk.verify +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story import java.util.stream.IntStream +@Epic("V1.0 UseCase") +@Feature("Problem") +@Story("ReadProblem") class ReadProblemUseCaseTest : BehaviorSpec({ diff --git a/api/src/test/kotlin/com/few/api/domain/subscription/controller/SubscriptionApiControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/subscription/controller/SubscriptionApiControllerTest.kt index a46807a33..08002822c 100644 --- a/api/src/test/kotlin/com/few/api/domain/subscription/controller/SubscriptionApiControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/subscription/controller/SubscriptionApiControllerTest.kt @@ -12,6 +12,8 @@ import com.few.api.domain.subscription.controller.request.UnsubscribeWorkbookReq import com.few.api.domain.subscription.controller.request.UpdateSubscriptionDayRequest import com.few.api.domain.subscription.controller.request.UpdateSubscriptionTimeRequest import com.few.api.domain.subscription.usecase.dto.* +import io.qameta.allure.Feature +import io.qameta.allure.Story import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.doNothing @@ -26,6 +28,7 @@ import web.description.Description import web.helper.* import java.time.LocalTime +@Feature("Subscription API") class SubscriptionApiControllerTest : ApiControllerTestSpec() { companion object { private const val BASE_URL = "/api/v1/" @@ -34,6 +37,7 @@ class SubscriptionApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[GET] /api/v1/subscriptions/workbooks?view=mainCard") + @Story("[GET] /api/v1/subscriptions/workbooks?view=mainCard") @WithUserDetails(userDetailsServiceBeanName = "apiTestTokenUserDetailsService") fun browseSubscribeWorkbooksViewMainCard() { // given @@ -133,6 +137,7 @@ class SubscriptionApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[GET] /api/v1/subscriptions/workbooks?view=myPage") + @Story("[GET] /api/v1/subscriptions/workbooks?view=myPage") @WithUserDetails(userDetailsServiceBeanName = "apiTestTokenUserDetailsService") fun browseSubscribeWorkbooksViewMyPage() { // given @@ -222,6 +227,7 @@ class SubscriptionApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[POST] /api/v1/workbooks/{workbookId}/subs") + @Story("[POST] /api/v1/workbooks/{workbookId}/subs") @WithUserDetails(userDetailsServiceBeanName = "apiTestTokenUserDetailsService") fun subscribeWorkbook() { // given @@ -271,6 +277,7 @@ class SubscriptionApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[POST] /api/v1/workbooks/{workbookId}/unsubs") + @Story("[POST] /api/v1/workbooks/{workbookId}/unsubs") @WithUserDetails(userDetailsServiceBeanName = "apiTestTokenUserDetailsService") fun unsubscribeWorkbook() { // given @@ -331,6 +338,7 @@ class SubscriptionApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[POST] /api/v1/subscriptions/unsubs") + @Story("[POST] /api/v1/subscriptions/unsubs") @WithUserDetails(userDetailsServiceBeanName = "apiTestTokenUserDetailsService") fun deactivateAllSubscriptions() { // given @@ -389,6 +397,7 @@ class SubscriptionApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[PATCH] /api/v1/subscriptions/time") + @Story("[PATCH] /api/v1/subscriptions/time") @WithUserDetails(userDetailsServiceBeanName = "apiTestTokenUserDetailsService") fun updateSubscriptionTime() { // given @@ -443,6 +452,7 @@ class SubscriptionApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[PATCH] /api/v1/subscriptions/day") + @Story("[PATCH] /api/v1/subscriptions/day") @WithUserDetails(userDetailsServiceBeanName = "apiTestTokenUserDetailsService") fun updateSubscriptionDay() { // given diff --git a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/BrowseSubscribeWorkbooksUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/BrowseSubscribeWorkbooksUseCaseTest.kt index 617f8cda1..c874c0633 100644 --- a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/BrowseSubscribeWorkbooksUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/BrowseSubscribeWorkbooksUseCaseTest.kt @@ -18,8 +18,14 @@ import io.kotest.matchers.shouldBe import io.mockk.every import io.mockk.mockk import io.mockk.verify +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story import java.time.LocalTime +@Epic("V1.0 UseCase") +@Feature("Subscription") +@Story("BrowseSubscribeWorkbooks") class BrowseSubscribeWorkbooksUseCaseTest : BehaviorSpec({ val log = KotlinLogging.logger {} diff --git a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCaseTest.kt index 6e1a59f49..01346b449 100644 --- a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCaseTest.kt @@ -14,9 +14,15 @@ import io.mockk.every import io.mockk.just import io.mockk.mockk import io.mockk.verify +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story import org.springframework.context.ApplicationEventPublisher import java.time.LocalTime +@Epic("V1.0 UseCase") +@Feature("Subscription") +@Story("SubscribeWorkBook") class SubscribeWorkbookUseCaseTest : BehaviorSpec({ val log = KotlinLogging.logger {} diff --git a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeAllUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeAllUseCaseTest.kt index 65f85992b..7e751a987 100644 --- a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeAllUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeAllUseCaseTest.kt @@ -9,7 +9,13 @@ import io.mockk.every import io.mockk.just import io.mockk.mockk import io.mockk.verify +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story +@Epic("V1.0 UseCase") +@Feature("Subscription") +@Story("UnsubscribeAll") class UnsubscribeAllUseCaseTest : BehaviorSpec({ val log = KotlinLogging.logger {} diff --git a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeWorkbookUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeWorkbookUseCaseTest.kt index cea6dc508..0af67ae78 100644 --- a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeWorkbookUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/UnsubscribeWorkbookUseCaseTest.kt @@ -5,7 +5,13 @@ import com.few.api.domain.subscription.usecase.dto.UnsubscribeWorkbookUseCaseIn import io.github.oshai.kotlinlogging.KotlinLogging import io.kotest.core.spec.style.BehaviorSpec import io.mockk.* +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story +@Epic("V1.0 UseCase") +@Feature("Subscription") +@Story("UnsubscribeWorkBook") class UnsubscribeWorkbookUseCaseTest : BehaviorSpec({ val log = KotlinLogging.logger {} diff --git a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/model/WorkbookSubscriptionHistoryTest.kt b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/model/WorkbookSubscriptionHistoryTest.kt index fa0fd18dc..c2c9054f1 100644 --- a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/model/WorkbookSubscriptionHistoryTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/model/WorkbookSubscriptionHistoryTest.kt @@ -1,9 +1,13 @@ package com.few.api.domain.subscription.usecase.model +import io.qameta.allure.Epic +import io.qameta.allure.Feature import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test +@Epic("V1.0 Model") +@Feature("WorkbookSubscriptionHistory") class WorkbookSubscriptionHistoryTest { @Test fun `새로 생성된 구독인데 구독 상태가 존재하는 경우`() { diff --git a/api/src/test/kotlin/com/few/api/domain/workbook/article/controller/WorkBookArticleApiControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/workbook/article/controller/WorkBookArticleApiControllerTest.kt index 316db6e55..578980903 100644 --- a/api/src/test/kotlin/com/few/api/domain/workbook/article/controller/WorkBookArticleApiControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/workbook/article/controller/WorkBookArticleApiControllerTest.kt @@ -9,6 +9,8 @@ import com.few.api.domain.common.vo.CategoryType import com.few.api.domain.workbook.article.dto.ReadWorkBookArticleOut import com.few.api.domain.workbook.article.dto.ReadWorkBookArticleUseCaseIn import com.few.api.domain.workbook.article.dto.WriterDetail +import io.qameta.allure.Feature +import io.qameta.allure.Story import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` @@ -22,6 +24,7 @@ import web.helper.* import java.net.URL import java.time.LocalDateTime +@Feature("WorkBook Article API") class WorkBookArticleApiControllerTest : ApiControllerTestSpec() { companion object { private const val BASE_URL = "/api/v1/workbooks/{workbookId}/articles" @@ -30,6 +33,7 @@ class WorkBookArticleApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[GET] /api/v1/workbooks/{workbookId}/articles/{articleId}") + @Story("[GET] /api/v1/workbooks/{workbookId}/articles/{articleId}") @WithUserDetails(userDetailsServiceBeanName = "apiTestTokenUserDetailsService") fun readWorkBookArticle() { // given diff --git a/api/src/test/kotlin/com/few/api/domain/workbook/controller/WorkBookApiControllerTest.kt b/api/src/test/kotlin/com/few/api/domain/workbook/controller/WorkBookApiControllerTest.kt index 1adabd53c..2f09c1aaf 100644 --- a/api/src/test/kotlin/com/few/api/domain/workbook/controller/WorkBookApiControllerTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/workbook/controller/WorkBookApiControllerTest.kt @@ -9,6 +9,8 @@ import com.few.api.domain.common.vo.CategoryType import com.few.api.domain.common.vo.ViewCategory import com.few.api.domain.common.vo.WorkBookCategory import com.few.api.domain.workbook.usecase.dto.* +import io.qameta.allure.Feature +import io.qameta.allure.Story import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` @@ -22,6 +24,7 @@ import web.helper.* import java.net.URL import java.time.LocalDateTime +@Feature("WorkBook API") class WorkBookApiControllerTest : ApiControllerTestSpec() { companion object { private const val BASE_URL = "/api/v1/workbooks" @@ -30,6 +33,7 @@ class WorkBookApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[GET] /api/v1/workbooks/categories") + @Story("[GET] /api/v1/workbooks/categories") fun browseWorkBookCategories() { // given val api = "BrowseWorkBookCategories" @@ -75,6 +79,7 @@ class WorkBookApiControllerTest : ApiControllerTestSpec() { */ @Test @DisplayName("[GET] /api/v1/workbooks") + @Story("[GET] /api/v1/workbooks") fun browseWorkBooks() { // given val api = "BrowseWorkBooks" @@ -164,6 +169,7 @@ class WorkBookApiControllerTest : ApiControllerTestSpec() { @Test @DisplayName("[GET] /api/v1/workbooks/{workbookId}") + @Story("[GET] /api/v1/workbooks/{workbookId}") fun readWorkBook() { // given val api = "ReadWorkBook" diff --git a/api/src/test/kotlin/com/few/api/domain/workbook/usecase/BrowseWorkbooksUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/workbook/usecase/BrowseWorkbooksUseCaseTest.kt index e0ccbde33..6486ed627 100644 --- a/api/src/test/kotlin/com/few/api/domain/workbook/usecase/BrowseWorkbooksUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/workbook/usecase/BrowseWorkbooksUseCaseTest.kt @@ -15,10 +15,16 @@ import io.kotest.matchers.shouldBe import io.mockk.every import io.mockk.mockk import io.mockk.verify +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story import java.net.URL import java.time.LocalDateTime import java.util.stream.IntStream +@Epic("V1.0 UseCase") +@Feature("WorkBook") +@Story("BrowseWorkbooks") class BrowseWorkbooksUseCaseTest : BehaviorSpec({ lateinit var workbookDao: WorkbookDao diff --git a/api/src/test/kotlin/com/few/api/domain/workbook/usecase/ReadWorkbookUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/workbook/usecase/ReadWorkbookUseCaseTest.kt index 04ff5da3d..39f7c3b21 100644 --- a/api/src/test/kotlin/com/few/api/domain/workbook/usecase/ReadWorkbookUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/workbook/usecase/ReadWorkbookUseCaseTest.kt @@ -14,9 +14,15 @@ import io.kotest.matchers.shouldBe import io.mockk.every import io.mockk.mockk import io.mockk.verify +import io.qameta.allure.Epic +import io.qameta.allure.Feature +import io.qameta.allure.Story import java.net.URL import java.time.LocalDateTime +@Epic("V1.0 UseCase") +@Feature("WorkBook") +@Story("ReadWorkBook") class ReadWorkbookUseCaseTest : BehaviorSpec({ lateinit var workbookDao: WorkbookDao diff --git a/api/src/test/kotlin/com/few/api/domain/workbook/usecase/model/order/AuthMainViewWorkbookOrderDelegatorTest.kt b/api/src/test/kotlin/com/few/api/domain/workbook/usecase/model/order/AuthMainViewWorkbookOrderDelegatorTest.kt index 1fdfdb7e6..3a56cabc3 100644 --- a/api/src/test/kotlin/com/few/api/domain/workbook/usecase/model/order/AuthMainViewWorkbookOrderDelegatorTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/workbook/usecase/model/order/AuthMainViewWorkbookOrderDelegatorTest.kt @@ -3,6 +3,8 @@ package com.few.api.domain.workbook.usecase.model.order import com.few.api.domain.workbook.usecase.model.MemberSubscribedWorkbook import com.few.api.domain.workbook.usecase.model.WorkBook import com.few.api.domain.workbook.usecase.model.WorkBooks +import io.qameta.allure.Epic +import io.qameta.allure.Feature import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Test import java.net.URL @@ -10,6 +12,8 @@ import java.time.LocalDateTime import java.util.stream.IntStream import kotlin.streams.toList +@Epic("V1.0 Model") +@Feature("AuthMainViewWorkbookOrderDelegator") class AuthMainViewWorkbookOrderDelegatorTest { @Test fun `워크북과 멤버 구독 워크북이 모두 주어지는 경우`() { diff --git a/build.gradle.kts b/build.gradle.kts index 6181afa1d..21a6c7135 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -88,6 +88,7 @@ allprojects { tasks.withType { useJUnitPlatform() + systemProperty("allure.results.directory", "$projectDir/build/allure-results") } sourceSets { @@ -160,12 +161,15 @@ subprojects { testImplementation("io.mockk:mockk:${DependencyVersion.MOCKK}") testImplementation("com.tngtech.archunit:archunit-junit5:${DependencyVersion.ARCH_UNIT_JUNIT5}") testImplementation("org.springframework.modulith:spring-modulith-starter-test") + testImplementation("io.qameta.allure:allure-junit5:${DependencyVersion.ALLURE_JUNIT5}") /** kotest */ testImplementation("io.kotest:kotest-runner-junit5:${DependencyVersion.KOTEST}") testImplementation("io.kotest:kotest-assertions-core:${DependencyVersion.KOTEST}") + testImplementation("io.kotest:kotest-framework-api:${DependencyVersion.KOTEST}") testImplementation("io.kotest.extensions:kotest-extensions-spring:${DependencyVersion.KOTEST_EXTENSION}") testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${DependencyVersion.COROUTINE_TEST}") + testImplementation("io.kotest.extensions:kotest-extensions-allure:${DependencyVersion.KOTEST_EXTENSION}") /** Kotlin Logger **/ implementation("io.github.oshai:kotlin-logging-jvm:${DependencyVersion.KOTLIN_LOGGING}") diff --git a/buildSrc/src/main/kotlin/DependencyVersion.kt b/buildSrc/src/main/kotlin/DependencyVersion.kt index 910d617bd..ebec964a9 100644 --- a/buildSrc/src/main/kotlin/DependencyVersion.kt +++ b/buildSrc/src/main/kotlin/DependencyVersion.kt @@ -30,10 +30,11 @@ object DependencyVersion { /** test */ const val MOCKK = "1.13.9" const val KOTEST = "5.8.0" - const val KOTEST_EXTENSION = "1.1.3" + const val KOTEST_EXTENSION = "1.3.0" const val COROUTINE_TEST = "1.8.0" const val TEST_CONTAINER = "1.19.8" const val ARCH_UNIT_JUNIT5 = "0.22.0" + const val ALLURE_JUNIT5 = "2.29.1" /** docs */ const val ASCIIDOCTOR = "3.3.2"