Skip to content

Commit 8d0a976

Browse files
docs: Updated petclinic README (#67)
* updated petclinic README Signed-off-by: Pranshu Srivastava <[email protected]> * docs: updated Petclinic README Signed-off-by: Pranshu Srivastava <[email protected]> * docs: made changes according to comments Signed-off-by: Pranshu Srivastava <[email protected]> * docs: removed redundant section Signed-off-by: Pranshu Srivastava <[email protected]> * docs: added \n Signed-off-by: Pranshu Srivastava <[email protected]> * docs: made changes according to the comments Signed-off-by: Pranshu Srivastava <[email protected]> --------- Signed-off-by: Pranshu Srivastava <[email protected]>
1 parent 148087d commit 8d0a976

File tree

16 files changed

+4335
-1344
lines changed

16 files changed

+4335
-1344
lines changed

spring-petclinic/README.md

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
## Introduction
22

33
This is a petclinic app where you can record testcases and mocks by interacting with the UI, and then test them using Keploy.
4-
This project has two parts - the frontend and backend, since Keploy is a backend testing platform, we need to start the backend part of the project
5-
using Keploy and run the frontend as it is.
6-
You can start the backend using Keploy in 2 ways:
7-
- Using Keploy's binary.
8-
- Using Keploy's docker image.
4+
This project has two parts - the frontend and backend, since Keploy is a backend testing platform, we need to start the backend part of the project using Keploy and run the frontend as it is.
95

10-
Prerequisites For Binary:
11-
1. Node 20.11.0 LTS
12-
2. OpenJDK 17.0.9
13-
3. MVN version 3.6.3
6+
First, you need to install Keploy. For that you can use the command below:
147

15-
Prerequisites For Docker:
16-
1. Docker Desktop 4.25.2 and above
8+
```
9+
curl -O https://raw.githubusercontent.com/keploy/keploy/main/keploy.sh && source keploy.sh
10+
```
1711

1812
## Setup the frontend
1913

@@ -33,60 +27,73 @@ npm i
3327
npm run start
3428
```
3529

36-
# Instructions For Starting Using Binary
37-
38-
## Spin up the database
30+
Now it's time to setup the backend of our application. Let's move to the backend directory and get started.
3931

4032
```
41-
docker run -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 --net keploy-network --name mypostgres postgres:15.2
33+
cd samples-java/spring-petclinic/spring-petclinic-rest
4234
```
4335

44-
## Setup Keploy
36+
You can start the backend using Keploy in 2 ways:
37+
- [Using Keploy's binary](#binary-guide)
38+
- [Using Keploy's docker image](#docker-guide)
4539

46-
```
47-
wget https://raw.githubusercontent.com/keploy/keploy/main/keploy.sh && source keploy.sh
48-
```
40+
# Instructions For Starting Using Binary <a name="binary-guide"></a>
41+
42+
Prerequisites For Binary:
43+
1. Node 20.11.0 LTS
44+
2. OpenJDK 17.0.9
45+
3. MVN version 3.6.3
4946

5047
## Setup the backend
5148

49+
You need to update the postgresql properties, go to
50+
`spring-petclinic/spring-petclinic-rest/src/main/resources/application-postgresql.properties`
51+
and change
52+
5253
```
53-
cd samples-java/spring-petclinic/spring-petclinic-rest
54-
mvn clean install -Dmaven.test.skip=true
54+
spring.datasource.url=jdbc:postgresql://mypostgres:5432/petclinic
5555
```
5656

57-
You also need to update the postgresql properties, go to
57+
to
5858

5959
```
60-
spring-petclinic/spring-petclinic-rest/src/main/resources/application-postgresql.properties
60+
spring.datasource.url=jdbc:postgresql://localhost:5432/petclinic
6161
```
62-
63-
and change
62+
and then build the jar using:
6463

6564
```
66-
spring.datasource.url=jdbc:postgresql://mypostgres:5432/petclinic
65+
mvn clean install -Dmaven.test.skip=true
6766
```
6867

69-
to
68+
## Spin up the database
7069

7170
```
72-
spring.datasource.url=jdbc:postgresql://localhost:5432/petclinic
71+
docker run -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 --name mypostgres postgres:15.2
7372
```
7473

7574
## Recording the testcases with Keploy
7675

7776
```
78-
keploy record -c "java -jar target/<name-of-your-jar>"
77+
keploy record -c "java -jar target/spring-petclinic-rest-3.0.2.jar"
7978
```
8079
Now you can start interacting with the UI and Keploy will automatically create the testcases and mocks for it in a folder named 'keploy'.
8180

8281
## Running the testcases using Keploy
8382

8483
```
85-
keploy test -c "java -jar target/<name-of-your-jar>" --delay 20
84+
keploy test -c "java -jar target/spring-petclinic-rest-3.0.2.jar" --delay 20
8685
```
8786

88-
# Instructions For Starting Using Docker
89-
Here we just need to change the command used to start the application and it should work correctly.
87+
🎉 Hooray! You've made it to the end of the binary section! 🎉
88+
89+
Next we move on to the instructions to start the application using docker.
90+
91+
# Instructions For Starting Using Docker <a name="docker-guide"></a>
92+
93+
Prerequisites For Docker:
94+
1. Docker Desktop 4.25.2 and above
95+
96+
Here we just need to change the command used to start the application.
9097

9198
```
9299
keploy record -c "docker compose up" --containerName javaApp --buildDelay 100s
@@ -100,7 +107,4 @@ keploy test -c "docker compose up" --containerName javaApp --buildDelay 50s --de
100107
Here `delay` is the time it takes for your application to get started, after which Keploy will start running the testcases. If your application takes longer than 10s to get started, you can change the `delay` accordingly.
101108
`buildDelay` is the time that it takes for the image to get built. This is useful when you are building the docker image from your docker compose file itself.
102109

103-
Hope this helps you out, if you still have any questions, reach out to us on our [Slack](https://join.slack.com/t/keploy/shared_invite/zt-12rfbvc01-o54cOG0X1G6eVJTuI_orSA)
104-
105-
106-
110+
Hope this helps you out, if you still have any questions, reach out to us on our [Slack](https://join.slack.com/t/keploy/shared_invite/zt-12rfbvc01-o54cOG0X1G6eVJTuI_orSA)

0 commit comments

Comments
 (0)