Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Team6-Digital Insight for Health
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chen Liang
Team6-Digital Insight for Health
Commits
3b0f503f
Commit
3b0f503f
authored
4 months ago
by
Mingyuan Chen
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/cmy' into cmy
parents
9c0e4438
f08d251a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
build.gradle
+15
-9
15 additions, 9 deletions
build.gradle
src/test/java/com/cardiff/cmyTest/HospitalControllerIntegrationTest.java
+0
-39
0 additions, 39 deletions
...om/cardiff/cmyTest/HospitalControllerIntegrationTest.java
with
15 additions
and
48 deletions
build.gradle
+
15
−
9
View file @
3b0f503f
...
...
@@ -13,12 +13,23 @@ test {
}
}
jacoco
{
toolVersion
=
"0.8.10"
// 确保设置版本,Jenkins 有时会要求
}
jacocoTestReport
{
dependsOn
test
// ⚠️ 一定要先执行测试任务
dependsOn
test
reports
{
xml
.
required
=
true
html
.
required
=
true
csv
.
required
=
false
xml
.
outputLocation
=
layout
.
buildDirectory
.
file
(
"reports/jacoco/test/jacocoTestReport.xml"
)
}
// 确保 Jenkins 能找到 class 和 source 路径
classDirectories
.
setFrom
(
fileTree
(
"${buildDir}/classes/java/main"
))
sourceDirectories
.
setFrom
(
files
(
"src/main/java"
))
executionData
.
setFrom
(
fileTree
(
buildDir
).
include
(
"/jacoco/test.exec"
))
}
group
=
'com.cardiff.client_project'
...
...
@@ -49,16 +60,11 @@ dependencies {
annotationProcessor
'org.projectlombok:lombok'
testImplementation
'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly
'org.junit.platform:junit-platform-launcher'
//implementation 'org.seleniumhq.selenium:selenium-java:4.8.0'
testImplementation
(
"io.github.bonigarcia:webdrivermanager:5.2.0"
)
testImplementation
group:
'net.sourceforge.htmlunit'
,
name:
'htmlunit'
,
version:
'2.32'
testImplementation
group:
'org.seleniumhq.selenium'
,
name:
'selenium-java'
,
version:
'4.1.0'
}
tasks
.
named
(
'test'
)
{
useJUnitPlatform
()
}
This diff is collapsed.
Click to expand it.
src/test/java/com/cardiff/cmyTest/HospitalControllerIntegrationTest.java
deleted
100644 → 0
+
0
−
39
View file @
9c0e4438
package
com.cardiff.cmyTest
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.TestPropertySource
;
import
org.springframework.boot.test.web.server.LocalServerPort
;
import
org.springframework.http.MediaType
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.*;
@SpringBootTest
@AutoConfigureMockMvc
@TestPropertySource
(
properties
=
{
"spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver"
,
"spring.datasource.url=jdbc:mysql://localhost:3306/healthcare?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC"
,
"spring.datasource.username=root"
,
"spring.datasource.password=472500"
})
public
class
HospitalControllerIntegrationTest
{
@Autowired
private
MockMvc
mockMvc
;
@Autowired
private
ObjectMapper
objectMapper
;
@Test
public
void
testGetAllHospitalsIntegration
()
throws
Exception
{
mockMvc
.
perform
(
get
(
"/commonAdmin/hospital/all"
)
.
accept
(
MediaType
.
APPLICATION_JSON
))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
jsonPath
(
"$"
).
isArray
());
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment