You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/quick-start.md
+21-15Lines changed: 21 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,40 +8,46 @@ Prerequisite: [Setup **CHKware**](/docs/setup) to continue
8
8
9
9
:::
10
10
11
-
### A real business story
11
+
### 1. A business story
12
12
13
-
DummyJSON service a JSON response faker for API. Let's think of a business case based on the [listed APIs](https://dummyjson.com/docs).
13
+
DummyJSON service a JSON request / response faker for API. Let's think of a business case based on the [listed APIs](https://dummyjson.com/docs).
14
14
15
-
#### Business scenario:
15
+
#### Business case:
16
16
17
17
User should be able to add a post on DummyJSON service.
18
18
19
19
#### Test cases:
20
20
21
-
Suppose our webapp have a page to add a new post. This page also shows some user information. Let's imagine the API test workflow for this page.
21
+
Suppose our web application has a page to add a new post. This page also shows some user information.
22
+
23
+
Let's assume the API test workflow for this page looks like following:
22
24
23
25
1. User is able to login. API response have a bearer *access_token*.
24
26
2. User is able to get *self* or *me* URL to show user information on page.
25
27
3. User is able to create a post using that bearer *access_token*.
26
28
27
-
### Test implementation
29
+
Let's create API test cases for these steps.
30
+
31
+
### 2. Test implementation
28
32
29
33
To implement the above test cases we need to be able to fetch an API response. Fetch multiple different APIs in a flow. Let's do in with *CHKware*.
30
34
31
35
#### Prepare for the project.
32
36
33
-
- Create a directory in anywhere in your system and give it a meaningful name.
34
-
- Now open the console terminal where `chk` command is install. Follow setup steps if it hasn't been done already.
35
-
- Go to the directory in console using
37
+
- Create a directory called `my-api-project-tests` in anywhere in your system. You can give it any meaningful name.
38
+
- Now open the console terminal. Please make sure `chk` command is installed globally. Follow [setup steps](./setup.md) if it hasn't been done already.
39
+
- Go to the `my-api-project-tests` directory in console using
40
+
36
41
```shell
37
-
cd[DIRECTORY]
42
+
cdpath/to/my-api-project-tests
38
43
```
39
44
40
45
#### Login to get bearer *access_token*
41
46
42
-
- Create a file called `req-login.chk`. File name has no special significance. Open `req-login.chk` file, and add following:
47
+
- Create a file called `req-login.chk`.
48
+
- Open `req-login.chk` file in your favourite text editor, and add following:
This file is called *HTTP specification* or *HTTP spec* file in *CHKware*. This file holds configuration to call an URL.
70
+
This file is called *HTTP specification* or *HTTP spec* file in *CHKware*. This file holds configuration to make one HTTP request.
65
71
66
72
With `request:` node, we define what to request, and with `expose:` section we mention what to return. In this case the HTTP response body that was received.
67
73
@@ -72,7 +78,7 @@ expose:
72
78
73
79
- Create a file called `req-user-me.chk`. File name has no special significance. Open `req-user-me.chk` file, and add following:
0 commit comments