This repository has been archived by the owner on Aug 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
274 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
# 本地执行 | ||
|
||
## 子命令 | ||
|
||
本地执行子命令为:`run` | ||
::: code-group | ||
|
||
```bash [原生环境] | ||
$ youqu3 run | ||
``` | ||
```bash [虚拟环境] | ||
$ youqu3-cargo run | ||
``` | ||
::: | ||
|
||
## 用例驱动方式 | ||
|
||
### 执行所有用例 | ||
|
||
::: code-group | ||
|
||
```bash [原生环境] | ||
$ youqu3 run | ||
``` | ||
|
||
```bash [虚拟环境] | ||
$ youqu3-cargo run | ||
``` | ||
|
||
::: | ||
|
||
### 指定执行某一个用例 | ||
|
||
```python | ||
# test_xxx_001.py | ||
|
||
class TestCase: | ||
|
||
def test_xxx_001_1(self): | ||
... | ||
|
||
def test_xxx_001_2(self): | ||
... | ||
``` | ||
|
||
仅驱动执行这一条用例: | ||
|
||
::: code-group | ||
|
||
```bash [原生环境] | ||
$ youqu3 run -k test_xxx_001_1 | ||
``` | ||
```bash [虚拟环境] | ||
$ youqu3-cargo run -k test_xxx_001_1 | ||
``` | ||
::: | ||
|
||
如果你想执行这个 py 文件中所有的用例: | ||
|
||
::: code-group | ||
|
||
```bash [原生环境] | ||
$ youqu3 run -k test_xxx_001 | ||
``` | ||
```bash [虚拟环境] | ||
$ youqu3-cargo run -k test_xxx_001 | ||
``` | ||
::: | ||
|
||
### 指定某个目录执行 | ||
|
||
```shell | ||
autotest-my-app | ||
├── case | ||
│ ├── base_case.py | ||
│ ├── __init__.py | ||
│ ├── smoke | ||
│ │ ├── test_mycase_001.py | ||
│ │ └── test_mycase_002.py | ||
``` | ||
驱动执行 `smoke` 目录下所有用例: | ||
::: code-group | ||
```bash [原生环境] | ||
$ youqu3 run -k smoke | ||
``` | ||
```bash [虚拟环境] | ||
$ youqu3-cargo run -k smoke | ||
``` | ||
::: | ||
### 根据关键词执行 | ||
执行包含关键词的用例,关键词可以是用例对象中的任意字符,且大小写不敏感 | ||
模块名称、py 文件名称、类名、函数名等等都可以做为关键词 | ||
比如:`case/test_music_001.py::TestMusic::test_music_001` | ||
整个字符串中可以任意截取字符作为关键词。 | ||
关键词驱动支持` and/or/not` 表达式。 | ||
::: code-group | ||
```bash [原生环境] | ||
$ youqu3 run -k "music and 001" | ||
``` | ||
```bash [虚拟环境] | ||
$ youqu3-cargo run -k "music and 001" | ||
``` | ||
::: | ||
::: warning 注意: | ||
使用逻辑表达式的时候一定要加引号:`"music and 001"` | ||
::: | ||
### 根据标签执行 | ||
基于 YouQu 特有的 CSV 文件管理的标签,也可以是传统的 Pytest 标签:`@pytest.mark.L1` | ||
标签驱动支持` and/or/not` 表达式。 | ||
::: code-group | ||
```bash [原生环境] | ||
$ youqu3 run -t "L1 or smoke" | ||
``` | ||
```bash [虚拟环境] | ||
$ youqu3-cargo run -t "L1 or smoke" | ||
``` | ||
::: | ||
### 批量用例ID驱动执行 | ||
::: code-group | ||
```bash [原生环境] | ||
$ youqu3 run -t "id1 or id2 or id3 or id4" | ||
``` | ||
```bash [虚拟环境] | ||
$ youqu3-cargo run -t "id1 or id2 or id3 or id4" | ||
``` | ||
::: | ||
::: warning 注意: | ||
使用逻辑表达式的时候一定要加引号:`"id1 or id2 or id3 or id4"` | ||
::: | ||
### 指定用例文件路径执行 | ||
指定用例文件 | ||
::: code-group | ||
```bash [原生环境] | ||
$ youqu3 run -f case/test_music_001.py | ||
``` | ||
```bash [虚拟环境] | ||
$ youqu3-cargo run -f case/test_music_001.py | ||
``` | ||
::: | ||
指定用例目录 | ||
::: code-group | ||
```bash [原生环境] | ||
$ youqu3 run -f case | ||
``` | ||
```bash [虚拟环境] | ||
$ youqu3-cargo run -f case | ||
``` | ||
::: | ||
用例文件、目录组合 | ||
::: code-group | ||
```bash [原生环境] | ||
$ youqu3 run -f "case/test_music_001.py case/test_music_002.py" | ||
``` | ||
```bash [虚拟环境] | ||
$ youqu3-cargo run -f "case/test_music_001.py case/test_music_002.py" | ||
``` | ||
::: | ||
::: warning 注意: | ||
多个用例文件、目录之间用空格分割,加引号 | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# 自定义执行 | ||
|
||
YouQu3 支持在 txt 文件中自定义用例集驱动执行: | ||
|
||
- youqu-tags.txt | ||
- youqu-keywords.txt | ||
|
||
## youqu-tags.txt | ||
|
||
在根目录下定义 `youqu-tags.txt` 文件,YouQu3 会自动加载并执行。 | ||
|
||
`youqu-tags.txt` 文件里面写标签的表达式,如: | ||
|
||
::: tip youqu-tags.txt | ||
|
||
id1 or id2 or id3 | ||
|
||
::: | ||
|
||
|
||
|
||
## youqu-keywords.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# 远程执行 | ||
|
||
## 子命令 | ||
|
||
远程执行就是用本地作为服务端控制远程机器执行,远程机器执行的用例相同; | ||
|
||
远程执行使用子命令: `remote` | ||
|
||
::: code-group | ||
```bash [原生环境] | ||
$ youqu3 remote -e | ||
``` | ||
```bash [虚拟环境] | ||
$ youqu3-cargo remote -e | ||
``` | ||
::: | ||
|
||
::: details 开启 SSH | ||
执行前确保远程机器已经开启了 `SSH` 服务,否则会提示无法连接: | ||
|
||
|
||
```bash | ||
$ sudo systemctl restart ssh | ||
``` | ||
|
||
::: | ||
|
||
## 远程测试机分组策略 | ||
|
||
### 分组规则 | ||
|
||
一对大括号表示一个组: | ||
|
||
```txt | ||
{user1@ip1/user2@ip2}{user3@ip3/user4@ip4} | ||
``` | ||
|
||
以上写法表示有 2 个组(group): | ||
|
||
- `group1` : `user1@ip1/user2@ip2` | ||
- `group2` : `user3@ip3/user4@ip4` | ||
|
||
### 执行策略 | ||
|
||
::: tip 规则概述 | ||
|
||
**`同一组内瓜分执行,不同组之间相同执行`** | ||
|
||
::: | ||
|
||
::: code-group | ||
```bash [原生环境] | ||
$ youqu3 remote -c "{user1@ip1/user2@ip2}{user3@ip3/user4@ip4}" | ||
``` | ||
```bash [虚拟环境] | ||
$ youqu3-cargo remote -c "{user1@ip1/user2@ip2}{user3@ip3/user4@ip4}" | ||
``` | ||
::: | ||
|
||
假设总共 100 条用例: | ||
|
||
- `group1` 和 `group2` 都`同时执行 100 条` | ||
- `group1` 包含 2 个测试机,2 个机器瓜分 100 条用例,`每个机器执行 50 条` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters