Skip to content

Conversation

@Pranav5255
Copy link

@Pranav5255 Pranav5255 commented Jun 18, 2025

feat(samples): Add .NET 8 & MongoDB CRUD Sample Application

Overview

This PR introduces a new sample application built with .NET 8 and MongoDB to demonstrate Keploy's capabilities with a widely-used enterprise technology stack.

Fixes #[issue-number]

Why this should be worked on

We currently don't have a sample for .NET + MongoDB, and adding one will help us reach and support more developers in the .NET ecosystem. This sample will serve as a practical, real-world example for users who want to see how Keploy can be used to generate tests and mocks for a .NET Web API interacting with a NoSQL database.

What this PR does

This PR adds a complete, self-contained CRUD API application with the following features:

  • Framework: .NET 8 Web API
  • Database: MongoDB, using the official .NET driver
  • Functionality: Full CRUD (Create, Read, Update, Delete) operations for a "Users" entity
  • API Documentation: Integrated Swagger/OpenAPI support for easy testing and discovery
  • Configuration: Clean separation of concerns using appsettings.json for MongoDB connection details
  • Documentation: Comprehensive README.md with setup instructions, prerequisites, and usage examples

Keploy Integration

Once the application is running, users can leverage Keploy to record test cases and generate data mocks seamlessly:

# Record API interactions
sudo -E env "PATH=$PATH" keploy record -c "dotnet run" --proxy-port 8080 --path ./keploy-tests

# Replay recorded tests
sudo -E env "PATH=$PATH" keploy test -c "dotnet run" --path ./keploy-tests --delay 10

Testing

The sample has been tested with:

  • .NET 8 SDK and Runtime
  • MongoDB 7.0
  • Keploy 2.0.0
  • Ubuntu 20.04

All CRUD operations work correctly, and test cases are successfully recorded and replayed by Keploy.

Signed-off-by: Pranav Metil 76805382+Pranav5255@users.noreply.github.com

@pratik-mahalle
Copy link

Hey @Pranav5255, Thank you for raising the pr. Our team will review the change before that please make sure to sign the DCO

Copy link
Contributor

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Pranav5255 can you please record some test cases using keploy and add as part of this sample quickstart? also please add readme file how to use this sample app

@Pranav5255
Copy link
Author

Pranav5255 commented Nov 3, 2025

Hey @Pranav5255 can you please record some test cases using keploy and add as part of this sample quickstart? also please add readme file how to use this sample app

Hey @Achanandhi-M I have added the snapshots of the necessary test cases in the readme and have also updated the doc to match the latest syntax. Please look into it.

Copy link
Contributor

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Pranav5255 , could you please add a README file with instructions on how to run the application, as well as how to record and replay using Keploy? That would really help others get started easily. Also please sign the DCO

Signed-off-by: Pranav5255 <pranavmetil@gmail.com>
Signed-off-by: Pranav Metil <76805382+Pranav5255@users.noreply.github.com>
Signed-off-by: Pranav5255 <pranavmetil@gmail.com>
Signed-off-by: Pranav5255 <pranavmetil@gmail.com>
Signed-off-by: Pranav5255 <pranavmetil@gmail.com>
@Pranav5255
Copy link
Author

Hey @Pranav5255 , could you please add a README file with instructions on how to run the application, as well as how to record and replay using Keploy? That would really help others get started easily. Also please sign the DCO

Hey @Achanandhi-M can you check this again, i have signed the dco to all the commits and updated the readme as well.

Copy link
Member

@kapishupadhyay22 kapishupadhyay22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @Pranav5255
Please remove the /assests and /img directories as they are not needed in the sample application, instead can you please add a small demonstration video in the comment of this PR for showing the whole flow of record and test mode.

Signed-off-by: Pranav5255 <pranavmetil@gmail.com>
Signed-off-by: Pranav5255 <pranavmetil@gmail.com>
Signed-off-by: Pranav5255 <pranavmetil@gmail.com>
@Pranav5255
Copy link
Author

Pranav5255 commented Nov 13, 2025

I think the app files got deleted while rebasing the commits and adding the signoffs. I have updated that and the documentation. Here's the video recording as well @Achanandhi-M @kapishupadhyay22 @pratik-mahalle

Final-Keploy.1.mp4

@kapishupadhyay22
Copy link
Member

Hi @Pranav5255
As mentioned earlier, please remove the /img directory as well.
Becauase that is not required in the repository.

@Pranav5255
Copy link
Author

Hi @Pranav5255 As mentioned earlier, please remove the /img directory as well. Becauase that is not required in the repository.

@kapishupadhyay22 I need to keep that dir as the images in the readme are present in that directory.

Signed-off-by: Pranav5255 <pranavmetil@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants