Skip to content

Commit 6e3fe93

Browse files
authored
docs: add api record instructions for karaf apps (#487)
* Update keploy-karaf.md Signed-off-by: Sarthak Shyngle <[email protected]> * Update keploy-karaf.md Signed-off-by: Sarthak Shyngle <[email protected]> --------- Signed-off-by: Sarthak Shyngle <[email protected]>
1 parent 1a8d3e3 commit 6e3fe93

File tree

1 file changed

+39
-29
lines changed

1 file changed

+39
-29
lines changed

versioned_docs/version-2.0.0/running-keploy/keploy-karaf.md

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,50 +57,53 @@ wget https://keploy-enterprise.s3.us-west-2.amazonaws.com/agent-jars/org.jacoco.
5757
### Update `config.properties`
5858

5959
1. Navigate to the `etc/config.properties` file in your Karaf installation.
60-
2. Add the following entry under the `bootdelegation` section to allow OSGi bundles to access Keploy artifacts:
60+
2. Add the following entries under the `bootdelegation` section to allow OSGi bundles to access Keploy artifacts:
6161

6262
```properties
6363
org.osgi.framework.bootdelegation = \
64-
com.sun.*, \
65-
javax.transaction, \
66-
javax.transaction.xa, \
67-
javax.xml.crypto, \
68-
javax.xml.crypto.*, \
69-
javax.security.cert, \
70-
jdk.nashorn.*, \
71-
sun.*, \
72-
jdk.internal.reflect, \
73-
jdk.internal.reflect.*, \
74-
org.apache.karaf.jaas.boot, \
75-
org.apache.karaf.jaas.boot.principal, \
76-
io.keploy.*
64+
... \
65+
io.keploy.*, \
66+
javax.servlet, \
67+
javax.servlet.http
7768
```
7869

79-
## Step 3: Start Apache Karaf and Export Environment Variables
70+
## Step 3: Export Environment Variables
8071

81-
1. Start Apache Karaf by navigating to the `bin` directory and running:
82-
83-
```bash
84-
./karaf
85-
```
86-
87-
2. Export the API key required for Keploy to function by running the following command in the same terminal session:
72+
1. Export the API key specific to your user, as mentioned on [Keploy's User Dashboard](https://app.keploy.io/users), which is required for Keploy to function, by running the following command in the same terminal session:
8873

8974
```bash
9075
export API_KEY="<API_KEY>"
9176
```
9277

9378
Replace the `API_KEY` value with your actual API key if different.
9479

95-
3. Export the application path to point to your target folder containing Java classes:
80+
2. Export the application path to point to your target folder containing Java classes:
9681

9782
```bash
9883
export APP_PATH="/Users/path/to/karaf-sample/user-service"
9984
```
10085

10186
Replace the `APP_PATH` value with the absolute path to your application's target folder.
10287

103-
## Step 4: Import Postman Collection
88+
## Step 4: Record Test Cases
89+
90+
1. Restart Apache Karaf by setting the environment variable `KEPLOY_MODE` to `RECORD`:
91+
92+
```bash
93+
export KEPLOY_MODE="RECORD"
94+
./karaf
95+
```
96+
97+
2. Record test cases using the following command:
98+
99+
```bash
100+
keploy record --base-url="http://localhost:8181"
101+
```
102+
103+
3. Make a series of API calls to your application's endpoints.
104+
4. After completing the API calls, press `Ctrl+C` in the session where you are running the Keploy binary to stop recording.
105+
106+
## Step 5: Or Use Import Postman Collection
104107

105108
1. Ensure you have a Postman collection ready for your application.
106109
2. Run the following command to import the Postman collection as Keploy tests:
@@ -111,13 +114,20 @@ wget https://keploy-enterprise.s3.us-west-2.amazonaws.com/agent-jars/org.jacoco.
111114

112115
Replace `/path/to/YourPostmanCollection.json` with the actual path to your Postman collection.
113116

114-
## Step 5: Run Keploy Tests
117+
## Step 6: Run Keploy Tests
115118

116-
Use the following command to run the imported tests:
119+
1. Restart Apache Karaf by setting the environment variable `KEPLOY_MODE` to `test`:
117120

118-
```bash
119-
keploy test --base-path="http://localhost:8181"
120-
```
121+
```bash
122+
export KEPLOY_MODE="test"
123+
./karaf
124+
```
125+
126+
2. Use the following command to run the imported tests:
127+
128+
```bash
129+
keploy test --base-path="http://localhost:8181"
130+
```
121131

122132
This assumes your Karaf application is running locally on port 8181.
123133

0 commit comments

Comments
 (0)