Skip to content

Commit 48c23ac

Browse files
authoredMar 14, 2025
Merge branch 'main' into O3-4521
2 parents 5fc19dc + 03d7d46 commit 48c23ac

File tree

6 files changed

+43
-13
lines changed

6 files changed

+43
-13
lines changed
 

‎README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This repository contains performance testing scripts and configurations for OpenMRS using Gatling.
44

55
The latest report can be found
6-
at [openmrs.github.io/openmrs-contrib-performance-test](https://openmrs.github.io/openmrs-contrib-performance-test/)
6+
at [here](https://o3-performance.openmrs.org/)
77

88
## Table of Contents
99

@@ -31,13 +31,15 @@ and easy-to-use framework for simulating user load and measuring system performa
3131

3232
To run the performance tests locally, follow these steps:
3333

34-
1. Start OpenMRS on port 80. (Use the docker file: [src/test/resources/docker-compose.yml](src/test/resources/docker-compose.yml) It contains demo patients for the test. [Learn more](#generating-demo-patient-data))
35-
36-
For using the docker file, run the following command:
37-
```bash
34+
1. Install dependencies (and compile)
35+
```bash
36+
./mvnw install -DskipTests
37+
```
38+
2. Start OpenMRS on port 80. (Use the docker file: [src/test/resources/docker-compose.yml](src/test/resources/docker-compose.yml) It contains demo patients for the test. [Learn more](#generating-demo-patient-data))
39+
```bash
3840
docker compose -f src/test/resources/docker-compose.yml up
39-
```
40-
2. Execute the following command in your terminal:
41+
```
42+
3. Execute the following command in your terminal:
4143

4244
**Standard** `export SIMULATION_PRESET='standard' && ./mvnw gatling:test` \
4345
**dev** `export SIMULATION_PRESET=dev TIER_COUNT=2 TIER_DURATION_MINUTES=1 USER_INCREMENT_PER_TIER=10 && ./mvnw gatling:test`

‎pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<properties>
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1212
<gatling.version>3.13.4</gatling.version>
13-
<gatling-maven-plugin.version>4.15.1</gatling-maven-plugin.version>
13+
<gatling-maven-plugin.version>4.16.1</gatling-maven-plugin.version>
1414
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
1515
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
1616
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
@@ -29,7 +29,7 @@
2929
<dependency>
3030
<groupId>com.fasterxml.jackson.core</groupId>
3131
<artifactId>jackson-databind</artifactId>
32-
<version>2.18.2</version>
32+
<version>2.18.3</version>
3333
</dependency>
3434
<dependency>
3535
<groupId>org.junit.jupiter</groupId>
@@ -40,12 +40,12 @@
4040
<dependency>
4141
<groupId>org.slf4j</groupId>
4242
<artifactId>slf4j-api</artifactId>
43-
<version>2.0.16</version>
43+
<version>2.0.17</version>
4444
</dependency>
4545
<dependency>
4646
<groupId>ch.qos.logback</groupId>
4747
<artifactId>logback-classic</artifactId>
48-
<version>1.5.16</version>
48+
<version>1.5.17</version>
4949
</dependency>
5050
</dependencies>
5151

‎src/test/java/org/openmrs/performance/http/DoctorHttpService.java

+15
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import static io.gatling.javaapi.core.CoreDsl.StringBody;
1717
import static io.gatling.javaapi.core.CoreDsl.bodyString;
1818
import static io.gatling.javaapi.core.CoreDsl.jsonPath;
19+
import static io.gatling.javaapi.http.HttpDsl.RawFileBodyPart;
20+
import static io.gatling.javaapi.http.HttpDsl.StringBodyPart;
1921
import static io.gatling.javaapi.http.HttpDsl.http;
2022
import static org.openmrs.performance.Constants.ALLERGY_REACTION_UUID;
2123
import static org.openmrs.performance.Constants.ARTERIAL_BLOOD_OXYGEN_SATURATION;
@@ -230,6 +232,19 @@ public HttpRequestActionBuilder getAllowedFileExtensions() {
230232
.get("/openmrs/ws/rest/v1/systemsetting?&v=custom:(value)&q=attachments.allowedFileExtensions");
231233
}
232234

235+
public HttpRequestActionBuilder uploadAttachment(String patientUuid) {
236+
return http("Upload Attachment Request")
237+
.post("/openmrs/ws/rest/v1/attachment")
238+
.bodyPart(StringBodyPart("fileCaption", "Test Image"))
239+
.bodyPart(StringBodyPart("patient", patientUuid))
240+
.bodyPart(
241+
RawFileBodyPart("file", "Sample_1MB_image.jpg")
242+
.contentType("image/jpg")
243+
.fileName("Sample_1MB_image.jpg")
244+
)
245+
.asMultipartForm();
246+
}
247+
233248
public HttpRequestActionBuilder getLabResults(String patientUuid) {
234249
return http("Get Lab Results of Patient")
235250
.get("/openmrs/ws/fhir2/R4/Observation?category=laboratory&patient=" + patientUuid + "&_count=100&_summary=data")

‎src/test/java/org/openmrs/performance/registries/DoctorRegistry.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ public ChainBuilder openVitalsAndBiometricsTab(String patientUuid) {
7171
MID_UPPER_ARM_CIRCUMFERENCE
7272
);
7373
return exec(httpService.getPatientObservations(patientUuid, vitals))
74-
.exec(httpService.getPatientObservations(patientUuid, biometrics))
75-
.exec(httpService.saveVitalsData(patientUuid));
74+
.exec(httpService.getPatientObservations(patientUuid, biometrics));
75+
}
76+
77+
public ChainBuilder recordVitals(String patientUuid){
78+
return exec(httpService.saveVitalsData(patientUuid));
7679
}
7780

7881
public ChainBuilder openMedicationsTab(String patientUuid) {
@@ -130,9 +133,15 @@ public ChainBuilder openAttachmentsTab(String patientUuid) {
130133
.exec(httpService.getAllowedFileExtensions());
131134
}
132135

136+
133137
public ChainBuilder openProgramsTab(String patientUuid) {
134138
return exec(httpService.getPrograms())
135139
.exec(httpService.getProgramEnrollments(patientUuid));
140+
}
141+
142+
public ChainBuilder addAttachment(String patientUuid){
143+
return exec(httpService.uploadAttachment(patientUuid))
144+
.exec(httpService.getAttachments(patientUuid));
136145
}
137146

138147
public ChainBuilder openVisitsTab(String patientUuid) {

‎src/test/java/org/openmrs/performance/scenarios/VisitPatientScenario.java

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public ScenarioBuilder getScenarioBuilder() {
3030
.pause(2)
3131
.exec(registry.openVitalsAndBiometricsTab("#{patient_uuid}"))
3232
.pause(5)
33+
.exec(registry.recordVitals("#{patient_uuid}"))
34+
.pause(5)
3335
.exec(registry.openMedicationsTab("#{patient_uuid}"))
3436
.pause(5)
3537
.exec(registry.openOrdersTab("#{patient_uuid}"))
@@ -49,6 +51,8 @@ public ScenarioBuilder getScenarioBuilder() {
4951
.exec(registry.openAttachmentsTab("#{patient_uuid}"))
5052
.pause(5)
5153
.exec(registry.openProgramsTab("#{patient_uuid}"))
54+
.pause(5)
55+
.exec(registry.addAttachment("#{patient_uuid}"))
5256
.pause(5)
5357
.exec(registry.addDrugOrder("#{patient_uuid}", "#{visitUuid}", "#{currentUserUuid}"))
5458
.pause(5)
1010 KB
Loading

0 commit comments

Comments
 (0)
Failed to load comments.