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: README.md
+61-7Lines changed: 61 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,29 @@ Restful API testing sample framework. ATDD is the suggested design pattern with
4
4
Jest is chosen since it is sharing the same `expect` library with webdriverio.
5
5
It is much faster then mocha due to inherent parallelization.
6
6
7
-
## Goal
8
-
9
-
TBA
7
+
## Overview
8
+
9
+
In this framework, you will find test suites for included restful api "Vegetable" service.
10
+
You will find three suites that are representing different design choices
11
+
- Test suite using super agent.
12
+
- Test suite using base api which represent DSL of 'Vegetable' application.
13
+
- Test suite using Resource Objects, explained below.
14
+
15
+
You can copy this library and use as you like, however think about the design choices you are changing.
16
+
17
+
Technology | Description
18
+
---------- | -----------
19
+
Acceptance Test Driven Development | ATDD involves team members with different perspectives (customer, development, testing) collaborating to write acceptance cases.
20
+
Resource Objects | Design pattern like Page Object, represent each endpoint as resource
21
+
Code as commit | Everything about test automation should be committed, including CI
22
+
23
+
Tools | Description
24
+
--- | ---
25
+
superagent | Request is a library for making HTTP requests. This will be used for making the HTTP requests in the tests
26
+
jest | Jest is a test executor that is running async. It includes assertion library.
27
+
eslint | Static code analysis tool for Javascript
28
+
husky | Regulate code commit (with linter in this case)
29
+
express | Express is popular HTTP framework for NodeJS which will be used for creating the System Under Test.
10
30
11
31
## Setup
12
32
First need to create your own configurations.
@@ -15,15 +35,15 @@ Copy the sample.env and rename to `.env`
15
35
16
36
```npm install```
17
37
18
-
- Run tests in local
19
-
20
-
```npm test```
21
-
22
38
In case you want to run against sample api *Vegetables*,
23
39
run the server with
24
40
25
41
```npm start```
26
42
43
+
Run tests in local
44
+
45
+
```npm test```
46
+
27
47
## Test Suites and Example usage
28
48
These are example usages of library. From 1 to 3 abstraction of endpoints increases.
29
49
@@ -51,6 +71,40 @@ Uses resource object, this is a similar method used in selenium with **page Obje
51
71
- usage of superagent/requests encapsulated, however still usable look at tc#3
52
72
- Pre-initialized resource-objects, it serve as a facade to service under test.
53
73
74
+
## Familiarizing Yourself with the System Under Test
75
+
76
+
It's always necessary to get to know the code you are testing.
77
+
Let us examine the API that we are testing. The purpose of the API is to be an interface with a vegetable database.
78
+
Supports the following operations:
79
+
80
+
- Adding a vegetable
81
+
- Deleting a vegetable
82
+
- Getting all vegetables
83
+
84
+
The API supports adding and deleting individual vegetables. You can also get all vegetables in the database. Here are the API routes:
85
+
86
+
* GET /vegetables
87
+
* Description
88
+
* Get all the vegetables in the database
89
+
* Query Parameters
90
+
* upperCase
91
+
* If set to "true" the vegetable's name will be return uppercase
92
+
* Default is false
93
+
* optional
94
+
* If set to "true", return will include optional: `origin`
0 commit comments