|
| 1 | +--- |
| 2 | +id: openhospital |
| 3 | +title: Keploy with OpenHospital |
| 4 | +sidebar_label: OpenHospital (Mysql) |
| 5 | +description: The following sample app showcases how to use Keploy and create test cases and mocks for popular spring-boot java application. |
| 6 | +tags: |
| 7 | + - java |
| 8 | + - spring-jpa |
| 9 | + - springboot |
| 10 | + - React |
| 11 | + - java-framework |
| 12 | + - postgres |
| 13 | + - openhospital |
| 14 | + - quickstart |
| 15 | + - samples |
| 16 | + - examples |
| 17 | + - tutorial |
| 18 | +keyword: |
| 19 | + - Jacoco |
| 20 | + - Maven |
| 21 | + - Springboot Framework |
| 22 | + - Mysql |
| 23 | + - SQL |
| 24 | + - Java |
| 25 | + - Test OpenHospital |
| 26 | + - Junit |
| 27 | + - React |
| 28 | +--- |
| 29 | + |
| 30 | +This is a openhospital app where you can record testcases and mocks by interacting with the UI, and then test them using Keploy. |
| 31 | + |
| 32 | +import Link from '@docusaurus/Link' |
| 33 | + |
| 34 | +import InstallationGuide from '../concepts/installation.md' |
| 35 | + |
| 36 | +<InstallationGuide/> |
| 37 | + |
| 38 | +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. |
| 39 | + |
| 40 | +## Setup the Core |
| 41 | + |
| 42 | +```bash |
| 43 | +git clone https://github.com/keploy/openhospital-core |
| 44 | +git checkout integration-with-keploy |
| 45 | +sudo apt install -y maven |
| 46 | +mvn clean install -DskipTests=true |
| 47 | +sudo docker compose up |
| 48 | + |
| 49 | +``` |
| 50 | + |
| 51 | +## Setup the Backend |
| 52 | + |
| 53 | +Now it's time to setup the backend of our application. Let's Download the Openhospital API and get started. |
| 54 | + |
| 55 | +```bash |
| 56 | +git clone https://github.com/keploy/openhospital-api |
| 57 | +git checkout integration-with-keploy |
| 58 | +mvn clean install -DskipTests=true |
| 59 | +``` |
| 60 | + |
| 61 | +You can start the Backend using Keploy cli: |
| 62 | + |
| 63 | +# Instructions For Starting Using Binary |
| 64 | + |
| 65 | +Prerequisites For Binary: |
| 66 | + |
| 67 | +1. Node 20.11.0 LTS |
| 68 | +2. OpenJDK 17.0.9 |
| 69 | +3. MVN version 3.6.3 |
| 70 | + |
| 71 | +## Recording the testcases with Keploy |
| 72 | + |
| 73 | +```bash |
| 74 | +keploy record -c "java -cp "target/openhospital-api-0.1.0.jar:rsc/:static/" org.springframework.boot.loader.launch.JarLauncher" |
| 75 | +``` |
| 76 | + |
| 77 | +## Start the frontend |
| 78 | + |
| 79 | +```bash |
| 80 | +git clone https://github.com/keploy/openhospital-ui |
| 81 | +git checkout integration-with-keploy |
| 82 | +npm install |
| 83 | +npm start |
| 84 | +``` |
| 85 | + |
| 86 | +Note: Login with username `admin` and password `admin` |
| 87 | + |
| 88 | +Now you can start interacting with the UI and Keploy will automatically create the testcases and mocks for it in a folder named 'keploy' |
| 89 | + |
| 90 | +## Running the testcases using Keploy |
| 91 | + |
| 92 | +```bash |
| 93 | +keploy test -c "java -cp "target/openhospital-api-0.1.0.jar:rsc/:static/" org.springframework.boot.loader.launch.JarLauncher" --delay 40 |
| 94 | + |
| 95 | +``` |
| 96 | + |
| 97 | +🎉 Hooray! You've made it to the end of the binary section! 🎉 |
| 98 | + |
| 99 | +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. |
| 100 | +`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. |
| 101 | + |
| 102 | +Hope this helps you out, if you still have any questions, reach out to us . |
| 103 | + |
| 104 | +import GetSupport from '../concepts/support.md' |
| 105 | + |
| 106 | +<GetSupport/> |
0 commit comments