Skip to content

Commit 2c2217c

Browse files
committed
fix(ci): change imports, add edit build gradle, fix make file, keep files,
1 parent 5e8cda8 commit 2c2217c

File tree

5 files changed

+51
-17
lines changed

5 files changed

+51
-17
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ out/
3838

3939
### Kotlin ###
4040
.kotlin
41+
42+
### allure ###
43+
allure-history/

build.gradle.kts

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22
import org.springframework.boot.gradle.tasks.bundling.BootWar
33

4+
val aspectJVersion = "1.9.22"
5+
val allureVersion = "2.29.1"
6+
7+
val agent: Configuration by configurations.creating {
8+
isCanBeConsumed = true
9+
isCanBeResolved = true
10+
}
11+
412
plugins {
513
war
614
id("org.springframework.boot") version "3.3.0"
@@ -14,6 +22,7 @@ plugins {
1422
group = "com.example"
1523
version = "0.0.1-SNAPSHOT"
1624

25+
1726
java {
1827
sourceCompatibility = JavaVersion.VERSION_17
1928
}
@@ -23,7 +32,9 @@ repositories {
2332
}
2433

2534
dependencies {
26-
implementation("org.springframework.boot:spring-boot-starter-web")
35+
agent("org.aspectj:aspectjweaver:$aspectJVersion")
36+
37+
implementation("org.springframework.boot:spring-boot-starter-web")
2738
implementation("org.jetbrains.kotlin:kotlin-reflect")
2839
implementation("org.slf4j:slf4j-api:2.0.7")
2940
implementation("ch.qos.logback:logback-classic:1.4.7")
@@ -32,19 +43,15 @@ dependencies {
3243
testImplementation("org.springframework.boot:spring-boot-starter-test")
3344

3445
testImplementation("junit:junit:4.13.2")
35-
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
3646

3747
testImplementation("io.rest-assured:kotlin-extensions:5.3.0")
3848
testImplementation("io.rest-assured:json-schema-validator:5.3.0")
3949

40-
testImplementation("io.qameta.allure:allure-junit4:2.21.0")
41-
}
42-
43-
allure {
44-
version.set("2.21.0")
50+
testImplementation(platform("io.qameta.allure:allure-bom:$allureVersion"))
51+
testImplementation("io.qameta.allure:allure-junit4")
52+
testImplementation("io.qameta.allure:allure-junit4-aspect")
4553
}
4654

47-
4855
tasks.withType<KotlinCompile> {
4956
kotlinOptions {
5057
freeCompilerArgs += "-Xjsr305=strict"
@@ -53,10 +60,14 @@ tasks.withType<KotlinCompile> {
5360
}
5461

5562
tasks.withType<Test> {
56-
useJUnitPlatform() // JUnit4
57-
testLogging {
58-
events("passed", "skipped", "failed")
59-
}
63+
ignoreFailures = true
64+
useJUnit() // JUnit4
65+
// testLogging {
66+
// events("passed", "skipped", "failed")
67+
// }
68+
// jvmArgs = listOf(
69+
// "-javaagent:${agent.singleFile}"
70+
// )
6071
}
6172

6273
tasks.named<BootWar>("bootWar") {

makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ ALLURE_VERSION=2.34.1
44
ALLURE_DIR=/opt/allure
55
ALLURE_BIN=/usr/bin/allure
66
ALLURE_TGZ=/tmp/allure.tgz
7+
ALLURE_HISTORY_DIR=allure-history
8+
ALLURE_RESULTS_DIR=build/allure-results
9+
ALLURE_REPORT_DIR=build/reports/allure-report/allureReport
710

811
.PHONY: test allure-report allure-serve install-allure setup
912

@@ -18,7 +21,15 @@ setup: install-allure test allure-report allure-serve
1821
# Generate Allure report
1922
allure-report:
2023
@echo "📊 Generating Allure report..."
21-
./gradlew allureReport
24+
# Copy history if exists
25+
if [ -d $(ALLURE_HISTORY_DIR) ]; then \
26+
mkdir -p $(ALLURE_RESULTS_DIR)/history; \
27+
sudo cp -r $(ALLURE_HISTORY_DIR)/* $(ALLURE_RESULTS_DIR)/history/; \
28+
fi
29+
./gradlew allureReport --clean
30+
# Save history for next run
31+
mkdir -p $(ALLURE_HISTORY_DIR)
32+
sudo cp -r $(ALLURE_REPORT_DIR)/history/* $(ALLURE_HISTORY_DIR)/ || true
2233

2334
# Serve Allure report
2435
allure-serve:

src/test/kotlin/tests/PlaceholderTest.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package tests
22

33
import io.qameta.allure.*
4+
import io.qameta.allure.junit4.Tag
45
import io.restassured.internal.RestAssuredResponseImpl
5-
import org.junit.jupiter.api.Assertions.assertEquals
6+
import org.junit.Test
7+
import org.junit.Assert.assertEquals
68
import org.junit.jupiter.api.Assertions.assertTrue
7-
import org.junit.jupiter.api.Tag
8-
import org.junit.jupiter.api.Test
99
import org.springframework.boot.test.context.SpringBootTest
1010
import org.springframework.http.HttpStatus.CREATED
1111
import org.springframework.http.HttpStatus.OK
@@ -17,12 +17,12 @@ import util.enums.schemas.PlaceHolderSchemas
1717
@SpringBootTest(classes = [Any::class])
1818
class PlaceholderTest {
1919

20+
@Test
2021
@Epic("Place holder API")
2122
@Feature("Post /posts")
2223
@Story("Should create posts")
2324
@Severity(SeverityLevel.CRITICAL)
2425
@Tag("sanity")
25-
@Test
2626
fun `Should create post`() {
2727
val payload = PostPayload("foo", "bar", 1)
2828
val response = PlaceholderService().createPost(payload, PlaceHolderSchemas.POST_CREATE_POST.schema) as RestAssuredResponseImpl
@@ -89,4 +89,12 @@ class PlaceholderTest {
8989
assertEquals(OK.value(), response.statusCode)
9090
helper.validateComments(firstComment, 1)
9191
}
92+
93+
// @Severity(SeverityLevel.CRITICAL)
94+
// @Tag("smokeTest")
95+
// @Test
96+
// fun `should fail`() {
97+
// assertTrue(false)
98+
// }
99+
92100
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
allure.results.directory=build/allure-results

0 commit comments

Comments
 (0)