Skip to content

Commit 5a7f55c

Browse files
Ishaanj18SonichigoGauriBhandari
authored andcommitted
Sse docs (#438)
* first commit Signed-off-by: ishaanj18 <[email protected]> * added documentation Signed-off-by: ishaanj18 <[email protected]> * added changes to version_2.0.0_sidebar.json Signed-off-by: ishaanj18 <[email protected]> * updated samples-go-sse-svelte.md Signed-off-by: ishaanj18 <[email protected]> * [docs]: Added instructions for using npm to run the Docusaurus site locally (#423) * docs(configuration): added example for handling nested JSON fields Added example for handling nested JSON fields Closes #1892 Signed-off-by: GauriBhandari <[email protected]> * docs: add instructions for using npm to run the Docusaurus site locally Added instructions for using npm to run the Docusaurus site locally Closes #2094 Signed-off-by: Gauri Bhandari <[email protected]> Signed-off-by: GauriBhandari <[email protected]> * docs: add instructions for using npm to run the Docusaurus site locally Added note Closes #2094 Signed-off-by: Gauri Bhandari <[email protected]> Signed-off-by: GauriBhandari <[email protected]> * Updated documentation to reflect npm migration Revised the documentation to include instructions for using npm instead of yarn Migration from using yarn to npm on docs website Closes #2094 Signed-off-by: Gauri Bhandari <[email protected]> Signed-off-by: GauriBhandari <[email protected]> * docs: update npm migration instructions Revised the documentation to include instructions for using npm instead of yarn. This change reflects the migration from using yarn to npm for building, testing, and deploying the docs website. Closes #2094 Signed-off-by: GauriBhandari <[email protected]> * ci: update lint.yml to ensure proper commit message formatting This commit updates the lint.yml file to ensure that commit messages follow the required format. Closes #2094 Signed-off-by: Gauri Bhandari <[email protected]> Signed-off-by: GauriBhandari <[email protected]> * docs: update npm migration instructions Closes #2094 Signed-off-by: Gauri Bhandari <[email protected]> Signed-off-by: GauriBhandari <[email protected]> * docs: update installation instructions for npm migration Revised the documentation to reflect the migration from Yarn to npm for building, testing, and deploying the docs website. Closes #2094 Signed-off-by: GauriBhandari <[email protected]> --------- Signed-off-by: GauriBhandari <[email protected]> Co-authored-by: Animesh Pathak <[email protected]> --------- Signed-off-by: ishaanj18 <[email protected]> Signed-off-by: Animesh Pathak <[email protected]> Signed-off-by: Gauri Bhandari <[email protected]> Co-authored-by: Animesh Pathak <[email protected]> Co-authored-by: Gauri Bhandari <[email protected]> Co-authored-by: Animesh Pathak <[email protected]>
1 parent fbf713b commit 5a7f55c

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed

versioned_docs/version-2.0.0/keploy-explained/docs-dev-guide.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ npm start
3939

4040
or
4141

42+
```shell
43+
npm start
44+
```
45+
46+
or
47+
4248
```shell
4349
yarn start
4450
```
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
id: samples-sse
3+
title: Sample Real-Time App (Svelte)
4+
sidebar_label: SSE + Svelte + MongoDB
5+
description: The following sample app tests Keploy integration capabilities with realtime subscriptions such as SSE
6+
tags:
7+
- go
8+
- quickstart
9+
- samples
10+
- examples
11+
- tutorial
12+
- svelte
13+
- SSE
14+
keyword:
15+
- Svelte
16+
- Server-Sent Events
17+
- MongoDB Mock
18+
- API Test generator
19+
- Auto Testcase generation
20+
---
21+
22+
## Introduction
23+
24+
🪄 Dive into the world of realtime subscriptions and see how seamlessly Keploy integrates with [SSE](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) and [MongoDB](https://www.mongodb.com/). Buckle up, it's gonna be a fun ride! 🎢
25+
26+
import InstallationGuide from '../concepts/installation.md'
27+
28+
<InstallationGuide/>
29+
30+
## Installation 📥
31+
32+
Ways you can run this sample application.
33+
34+
- [Using Docker container for MongoDB and running application locally](#installation-setup)
35+
36+
## Installation Setup
37+
38+
#### Server
39+
40+
```bash
41+
git clone https://github.com/keploy/samples-go.git && cd samples-go/sse-svelte
42+
go mod download
43+
```
44+
45+
### Start MongoDB Instance
46+
47+
Using the docker-compose file we will start our mongodb instance:-
48+
49+
```bash
50+
# Start Postgres
51+
docker-compose up mongo
52+
```
53+
54+
### Build Application Binary
55+
56+
Now, we will create the binary of our application:-
57+
58+
```bash
59+
go build -cover
60+
```
61+
62+
Once we have our applicaiton binary ready, we will start the application with keploy to start capturing the testcases.
63+
64+
## Capture the test cases
65+
66+
```bash
67+
sudo -E keploy record "./sse-mongo"
68+
```
69+
70+
### Start the UI
71+
72+
We will capture our test from the UI written in Svelte.js
73+
74+
```bash
75+
cd svelte-app && npm install && npm run dev
76+
```
77+
78+
Now let's click on `GetTime` button to trigger the event. We would notice that keploy will capture those calls : -
79+
![Testcases](https://github.com/keploy/samples-go/raw/main/sse-svelte/img/testcase.png?raw=true)
80+
81+
## Run the Testcases
82+
83+
Now let's run the test mode :-
84+
85+
```shell
86+
keploy test -c "./sse-mongo" --delay 10 --goCoverage
87+
```
88+
89+
Output should look like : -
90+
91+
![Testrun](https://github.com/keploy/samples-go/raw/main/sse-svelte/img/testrun.png?raw=true)
92+
93+
So no need to setup fake database/apis like Postgres or write mocks for them. Keploy automatically mocks them and, **The application thinks it's talking to MongoDb 😄**. And with just few clicks we were able to get 42% code coverage of our go backend application.

versioned_sidebars/version-2.0.0-sidebars.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
"quickstart/samples-redis",
8282
"quickstart/samples-mux",
8383
"quickstart/samples-mysql",
84+
"quickstart/samples-sse",
8485
"quickstart/samples-fasthttp"
8586
]
8687
},

0 commit comments

Comments
 (0)