Skip to content

Commit

Permalink
chore: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden committed Jun 7, 2021
1 parent 5fa8571 commit e0a5f05
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 58 deletions.
55 changes: 26 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,31 +248,8 @@ The following test cases can use all the data of the previous test cases.

### Support Mock

With Mock, no longer entangled in fabricating data
With Mock, no longer entangled in fabricating data, Seee [@mock](#mock)

```
{
test1: {
req: {
email: 'email', @mock
username: 'username', @mock
integer: 'integer(-5, 5)', @mock
image: 'image("200x100")', @mock
string: 'string("alpha", 5)', @mock
date: 'date', @mock // iso8601 format // 2021-06-03T07:35:55Z
date1: 'date("yyyy-mm-dd HH:MM:ss")' @mock // 2021-06-03 15:35:55
date2: 'date("unix")', @mock // unix epoch 1622705755
date3: 'date("","3 hours 15 minutes")', @mock
date4: 'date("","2 weeks ago")', @mock
ipv6: 'ipv6', @mock
sentence: 'sentence', @mock
cnsentence: 'cnsentence', @mock
}
}
}
```

> Apitest uses its own mock library (refer to mock.js), and mock functions can be added freely. If you have any mocks you want, please submit an issue.

### Support Mixin

Expand All @@ -295,9 +272,7 @@ At the same time, you can also select a test case to execute through the `--only

You don't need to use this function at all. But I still worry about the need in certain extreme or corner scenes, so I still support it.

Apitest allows users to write custom functions through js to construct request data or verify response data. (Dare to call it a cross-programming language? 🐶)

See [@jslib](#jslib)
Apitest allows users to write custom functions through js to construct request data or verify response data. (Dare to call it a cross-programming language? 🐶), See [@jslib](#jslib)

### Skip, Delay, Retry & Loop

Expand Down Expand Up @@ -617,6 +592,28 @@ The test cases in the group will inherit the group's `@client` and `@mixin`. The
Apitest supports nearly 40 mock functions. For a detailed list, see [fake-js](https://github.com/sigoden/fake-js#doc)

```
{
test1: {
req: {
email: 'email', @mock
username: 'username', @mock
integer: 'integer(-5, 5)', @mock
image: 'image("200x100")', @mock
string: 'string("alpha", 5)', @mock
date: 'date', @mock // iso8601 format // 2021-06-03T07:35:55Z
date1: 'date("yyyy-mm-dd HH:MM:ss")' @mock // 2021-06-03 15:35:55
date2: 'date("unix")', @mock // unix epoch 1622705755
date3: 'date("","3 hours 15 minutes")', @mock
date4: 'date("","2 weeks ago")', @mock
ipv6: 'ipv6', @mock
sentence: 'sentence', @mock
cnsentence: 'cnsentence', @mock
}
}
}
```

### @file

**Use file**
Expand Down Expand Up @@ -970,7 +967,7 @@ The `echo` client does not send any request, and directly returns the data in th

#### x-www-form-urlencoded

Only need to add the request header `"content-type": "application/x-www-form-urlencoded"`
Add the request header `"content-type": "application/x-www-form-urlencoded"`

```
{
Expand Down Expand Up @@ -1002,7 +999,7 @@ Only need to add the request header `"content-type": "application/x-www-form-url
#### multipart/form-data


Only need to add the request header `"content-type": "multipart/form-data"`
Add the request header `"content-type": "multipart/form-data"`
Combined with `@file` annotation to implement file upload

```
Expand Down
54 changes: 25 additions & 29 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,33 +248,9 @@ Apitest 的工作原理就是根据`req`部分的描述构造请求传给后端

有了Mock, 从此不再纠结编造数据。详见[@mock](#mock)


```
{
test1: {
req: {
email: 'email', @mock
username: 'username', @mock
integer: 'integer(-5, 5)', @mock
image: 'image("200x100")', @mock
string: 'string("alpha", 5)', @mock
date: 'date', @mock // iso8601格式的当前时间 // 2021-06-03T07:35:55Z
date1: 'date("yyyy-mm-dd HH:MM:ss")' @mock // 2021-06-03 15:35:55
date2: 'date("unix")', @mock // unix epoch 1622705755
date3: 'date("","3 hours 15 minutes")', @mock // 3小时15分钟后
date4: 'date("","2 weeks ago")', @mock // 2周前
ipv6: 'ipv6', @mock
sentence: 'sentence', @mock
cnsentence: 'cnsentence', @mock // 中文段落
}
}
}
```
> Apitest 使用的是自己的mock库(参考了mock.js),mock函数很自由添加的。有想要的mock欢迎提交issue。
### 支持Mixin

巧用 Mixin,摆脱复制粘贴。详见[@mixin]
巧用 Mixin,摆脱复制粘贴。详见[@mixin](#mixin)

### 支持CI

Expand All @@ -290,8 +266,6 @@ Apitest 的工作原理就是根据`req`部分的描述构造请求传给后端

同时,你还可以通过 `--only` 选项选择某个测试用例执行。

tdd! tdd! tdd!

### 支持用户定义函数

这个功能你根本不需要用到。但我还是担心在某些极限或边角的场景下需要,所以还是支持了。
Expand Down Expand Up @@ -611,6 +585,28 @@ main

Apitest 支持近40个mock函数。详细清单见[fake-js](https://github.com/sigoden/fake-js#doc)

```
{
test1: {
req: {
email: 'email', @mock
username: 'username', @mock
integer: 'integer(-5, 5)', @mock
image: 'image("200x100")', @mock
string: 'string("alpha", 5)', @mock
date: 'date', @mock // iso8601格式的当前时间 // 2021-06-03T07:35:55Z
date1: 'date("yyyy-mm-dd HH:MM:ss")' @mock // 2021-06-03 15:35:55
date2: 'date("unix")', @mock // unix epoch 1622705755
date3: 'date("","3 hours 15 minutes")', @mock // 3小时15分钟后
date4: 'date("","2 weeks ago")', @mock // 2周前
ipv6: 'ipv6', @mock
sentence: 'sentence', @mock
cnsentence: 'cnsentence', @mock // 中文段落
}
}
}
```

### @file

功能: 使用文件
Expand Down Expand Up @@ -960,7 +956,7 @@ Apitest 提供两种客户端。

#### x-www-form-urlencoded

只需要配置请求头 `"content-type": "application/x-www-form-urlencoded"`
配置请求头 `"content-type": "application/x-www-form-urlencoded"`

```
{
Expand Down Expand Up @@ -992,7 +988,7 @@ Apitest 提供两种客户端。
#### multipart/form-data


只需要配置请求头 `"content-type": "multipart/form-data"`
配置请求头 `"content-type": "multipart/form-data"`
结合 `@file` 注解实现文件上传

```
Expand Down

0 comments on commit e0a5f05

Please sign in to comment.