Next generation automated testing framework.
Project description
lounger
Next generation automated testing framework.
feature
🌟 支持web/api测试。
🌟 提供脚手架生成自动化项目。
🌟 更好用的数据驱动。
🌟 支持数据库操作。
🌟 已经配置好的测试报告(包含截图、日志)。
🌟 天然支持API objects、Page objects设计模式。
framework
lounger不是一个从零开始的自动化测试框架,建立在pytest生态的基础上,提供更加简单、方便的使用体验。
Install
- pip安装。
$ pip install lounger
- 体验最新的项目代码。
$ pip install -U git+https://github.com/SeldomQA/lounger.git@main
scaffold
lounger提供了脚手架,直接创建项目和使用。
$ lounger --help
Usage: lounger [OPTIONS]
lounger CLI.
Options:
--version Show version.
-pw, --project-web TEXT Create an Web automation test project.
-pa, --project-api TEXT Create an API automation test project.
--help Show this message and exit.
Web自动化项目
-
首先,请安装测试浏览器(至少一款)。
$ playwright install chromium[可选] $ playwright install firefox[可选] $ playwright install webkit[可选]
-
创建web自动化测试项目。
$ lounger --project-web myweb
-
运行项目
$ cd myweb $ pytest
API自动化项目
-
创建api自动化测试项目。
$ lounger --project-api myapi
注:项目包含通过YAML管理API测试用例,编写规范参考下面的文档。
-
运行测试
$ cd myapi $ pytest
测试报告
- lounger集成
pytest-xhtml,直接生成测试报告。
项目&文档&示例
数据库跳板机
如果业务环境访问数据库需要经过 SSH 跳板机,可以直接使用框架内置的 Fabric 封装,不需要在 conftest.py 里手动维护隧道对象、端口和关闭逻辑。
from pathlib import Path
import pytest
from lounger.db_operation import MySQLDB
from lounger.utils.variables import ExtractVar
_extractor = ExtractVar()
@pytest.fixture(scope="session")
def mysql_db():
with MySQLDB.from_ssh_tunnel(
ssh_host=_extractor.config("ssh_host"),
ssh_port=int(_extractor.config("ssh_port")),
ssh_user=_extractor.config("ssh_user"),
ssh_private_key=str(Path(_extractor.config("ssh_private_key")).expanduser()),
remote_db_host=_extractor.config("remote_db_host"),
remote_db_port=int(_extractor.config("remote_db_port")),
db_user=_extractor.config("db_user"),
db_password=_extractor.config("db_password"),
db_database=_extractor.config("db_database"),
db_charset=_extractor.config("db_charset"),
) as db:
yield db
上面的参数来源由业务自己决定,可以来自 conftest.py、环境变量、配置中心或其他任意配置方式。框架只负责隧道和数据库连接的封装。
对比
- seldom VS lounger 👉详细对比
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lounger-1.2.0.tar.gz.
File metadata
- Download URL: lounger-1.2.0.tar.gz
- Upload date:
- Size: 62.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4ada071969d5eb9f6f1768efe0b532e6e49fefff73b17ff369b8869c2068d79
|
|
| MD5 |
3ad08f3888c32a962818ff1ebc067f7e
|
|
| BLAKE2b-256 |
323c3b86a3671550c2ae04bdc2c0efba333c928176ee5df9983dab22f81b1816
|
File details
Details for the file lounger-1.2.0-py3-none-any.whl.
File metadata
- Download URL: lounger-1.2.0-py3-none-any.whl
- Upload date:
- Size: 82.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff00d1338edab8ba349fbe406da00ee127910d96836ba2f76a6aa152523bad3e
|
|
| MD5 |
5ad6088e209466647318b7f3188d5331
|
|
| BLAKE2b-256 |
9d86b3f37ea57d8cd9c0eeaba2e35fdc2fadc254648c369931293ddd7b3189e8
|