| id | openhospital | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| title | Keploy with OpenHospital | |||||||||||
| sidebar_label | OpenHospital | |||||||||||
| description | The following sample app showcases how to use Keploy and create test cases and mocks for popular spring-boot java application. | |||||||||||
| tags |
|
|||||||||||
| keyword |
|
import ProductTier from '@site/src/components/ProductTier';
This is a openhospital app where you can record testcases and mocks by interacting with the UI, and then test them using Keploy.
import Link from '@docusaurus/Link' import InstallReminder from '@site/src/components/InstallReminder';
This project has Three parts - the UI, Core and API, since Keploy is a backend testing platform, we need to start the Backend of the project using Keploy and run the frontend as it is.
git clone https://github.com/keploy/openhospital-core
cd openhospital-core/
git checkout integration-with-keploy
mvn clean install -DskipTests=true
docker compose upNote: If you face any issues while setting up the database, please try running docker compose up again. The issue should not occur the second time.
Now it's time to setup the backend of our application. Let's Install the Openhospital API and get started.
git clone https://github.com/keploy/openhospital-api
cd openhospital-api/
git checkout integration-with-keploy
mvn clean install -DskipTests=trueNow it's time to start the Backend using Keploy cli:
Prerequisites For Binary:
- Node 20.11.0 LTS
- OpenJDK 17.0.9
- MVN version 3.6.3
keploy record -c "java -cp "target/openhospital-api-0.1.0.jar:rsc/:static/" org.springframework.boot.loader.launch.JarLauncher"<img src="/docs/img/keploy-record-java.png" alt="Sample Keploy Record Java" width="100%" style={{ borderRadius: '5px' }} />
git clone https://github.com/keploy/openhospital-ui
cd openhospital-ui/
git checkout integration-with-keploy
npm install
npm startNote: Login with username admin and password admin
<img src="/docs/img/openhospital-ui.png" alt="Sample Keploy Record Java" width="100%" style={{ borderRadius: '5px' }} />
If you followed all the steps correctly, you should see a UI similar to the one shown above.
Now you can start interacting with the UI and Keploy will automatically create the testcases and mocks for it in a folder named 'keploy'
keploy test -c "java -cp "target/openhospital-api-0.1.0.jar:rsc/:static/" org.springframework.boot.loader.launch.JarLauncher" --delay 40
🎉 Hooray! You've made it to the end of the binary section! 🎉
Your CLI should look something like this <img src="/docs/img/keploy-test-openhospital.jpg" alt="Sample Keploy Test Java" width="100%" style={{ borderRadius: '5px' }} />
This is a summary of the test cases recorded <img src="/docs/img/keploy-testcase-openhospital.png" alt="Sample Keploy Test Summary Java" width="100%" style={{ borderRadius: '5px' }} />
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.
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.
Hope this helps you out, if you still have any questions, reach out to us .