Skip to content

Commit

Permalink
separate unit & it test
Browse files Browse the repository at this point in the history
  • Loading branch information
chinnawatsut committed Mar 22, 2024
1 parent 4566752 commit 0fa01d5
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 4 deletions.
62 changes: 59 additions & 3 deletions kbazaar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id 'io.spring.dependency-management' version '1.1.4'
id 'org.sonarqube' version '4.4.1.3373'
id 'com.diffplug.spotless' version '6.22.0'
id "com.adarshr.test-logger" version "4.0.0"
}

jacocoTestReport {
Expand Down Expand Up @@ -57,9 +58,17 @@ dependencies {
testImplementation 'com.tngtech.archunit:archunit-junit5:1.2.1'
}

tasks.named('test') {
useJUnitPlatform()
include '**/*Test.java'
test {
testLogging.showStandardStreams = true
useJUnitPlatform {
excludeTags 'integration'
}
}

task("it-test", type: Test) {
useJUnitPlatform {
includeTags 'integration-test'
}
}

sonar {
Expand All @@ -69,4 +78,51 @@ sonar {
property "sonar.token", System.getenv("SONAR_TOKEN")
property "sonar.host.url", System.getenv("SONAR_HOST_URL")
}
}

testlogger {
// pick a theme - mocha, standard, plain, mocha-parallel, standard-parallel or plain-parallel
theme 'mocha'

// set to false to disable detailed failure logs
showExceptions true

// set to false to hide stack traces
showStackTraces true

// set to true to remove any filtering applied to stack traces
showFullStackTraces true

// set to false to hide exception causes
showCauses true

// set threshold in milliseconds to highlight slow tests
slowThreshold 2000

// displays a breakdown of passes, failures and skips along with total duration
showSummary true

// set to true to see simple class names
showSimpleNames false

// set to false to hide passed tests
showPassed true

// set to false to hide skipped tests
showSkipped true

// set to false to hide failed tests
showFailed true

// enable to see standard out and error streams inline with the test results
showStandardStreams false

// set to false to hide passed standard out and error streams
showPassedStandardStreams true

// set to false to hide skipped standard out and error streams
showSkippedStandardStreams true

// set to false to hide failed standard out and error streams
showFailedStandardStreams true
}
5 changes: 4 additions & 1 deletion kbazaar/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ run:
./gradlew bootRun

test:
./gradlew test
./gradlew clean && ./gradlew test

it-test:
./gradlew clean && ./gradlew it-test

format:
./gradlew spotlessApply
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
@Tag("integration-test")
class KBazaarApplicationIT {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.List;
import java.util.Optional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
Expand Down

0 comments on commit 0fa01d5

Please sign in to comment.