PHPackages                             bonwe/bonwenium - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. bonwe/bonwenium

ActiveLibrary[Testing &amp; Quality](/categories/testing)

bonwe/bonwenium
===============

基于改装的webdriver,selenium思想，采用模块化封装的php自动化测试框架。开发者只需要掌握基础前端知识，基础php知识，就能通过精简的开发实现复杂自动化测试，大幅度提升开发效率，降低自动化测试门槛。

v1.1.6(6y ago)032MITPHP

Since Apr 2Pushed 6y agoCompare

[ Source](https://github.com/leizhu188/bonwenium)[ Packagist](https://packagist.org/packages/bonwe/bonwenium)[ RSS](/packages/bonwe-bonwenium/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (4)Versions (16)Used By (0)

bonwenium
=========

[](#bonwenium)

php自动化测试框架

使用
--

[](#使用)

安装浏览器（推荐chrome）
下载对应浏览器的webdriver,并驱动起来。
本项目更至最新版本，composer加载所有组件。
配置.env文件
执行 php bonwenium list 可以获取demo。

项目目录
----

[](#项目目录)

#### app/actions

[](#appactions)

常规步骤组件：
例如针对个人主页测试，个人收藏测试等，都需要登录后展开，故登录等 常规操作可写于acitons。

#### app/scenarios

[](#appscenarios)

情景步骤组件：
例如针对登录进行场景测试，如手机号格式，密码格式等多样化场景测试时，写于scenarios。

#### app/functions

[](#appfunctions)

自定义步骤组件：
例如输入验证码等特殊处理操作，需要扩展代码分析，故提供functions，继承主Controller，可以处理程序同时操作当前的webdriver实例。

#### app/steps

[](#appsteps)

生产线：
也称为组件集/步骤集，所有组件取自以上三种（常规，情景，自定义）组件，可以根据测试用例任意搭配。
一条完整的生产线可以成为一个完整需求的全套自动化测试。

#### config/app.php

[](#configappphp)

应用常规配置：
如 测试网站入口，日志导出方式，点击停顿时间等等。

#### config/web\_driver.php

[](#configweb_driverphp)

webdriver驱动配置：
驱动url，监听端口，驱动浏览器等。

组件开发者文档
-------

[](#组件开发者文档)

组件以字符串数组的方式实现element操作组合,一个字符串实现一个操作。

#### 事件操作：

[](#事件操作)

子集定位，以&gt;&gt;标识子集查找，查找类型 id,class,tag
`例   >>tag:li`
同级筛选，以&gt;标识同级筛选，查找类型 tag,id,text,num,css等
`例   >text:登录`
`例 查找第0个   >num:0`
具体操作，以&gt;&gt;&gt;标识具体操作， write,append,click等
`例  >>>write:新概念`
`例 点击   >>>click`
按上述可实现任何鼠标点击或者键盘写入操作，
`例 tag:div>>tag:button>text:登录>>>click`

#### 常规组件/情景组件：

[](#常规组件情景组件)

以事件操作数组的形式将不同事件按场景分析组合而成，遵循事件定位原则，有如下模式：

must\_step：必须执行的事件。
`例 "must_step" => "tag:button>text:登录>>>click"`

should\_step：非必须执行的事件。
`例 "should_step" => "tag:button>text:登录>>>click"`

sleep：停顿（秒）。
`例 "sleep" => 2`

usleep：停顿（微秒）。
`例 "usleep" => 500000`

scroll：滚动到指定位置
`例 "scroll" => "0,0"`

until：当某element出现/消失后。
`例 "until" => "tag:input>text:验证码>>>appear"`
`例 "until" => "tag:button>text:重试>>>disappear"`

asserts：断言。
`例 "asserts"=>["tag:button>text:发送>>>exist","tag:span>text:密码错误>>>no_exist"]`

function：自定义组件。
`例 "function"=>"User@writeResetPwdCaptcha@{"phone":18810680772}"`
`调用functions下的User.php中writeResetPwdCaptcha函数，参数以json定义，框架会自动解析并存入类变量datas中。可以使用$this->datas['phone']调用`

所以bonwenium极大幅度简化了开发者的代码量，只需掌握html和js基础知识，就可以编写出一个理想的自动化测试项目。

#### 生产线：

[](#生产线)

steps:由常规组件、情景组件、自定义组件等自由组合而成。一条生产线完成一个功能甚至一个完整项目的自动化测试。

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~16 days

Recently: every ~53 days

Total

15

Last Release

2412d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23211174?v=4)[leizhu188](/maintainers/leizhu188)[@leizhu188](https://github.com/leizhu188)

---

Top Contributors

[![leizhu188](https://avatars.githubusercontent.com/u/23211174?v=4)](https://github.com/leizhu188 "leizhu188 (34 commits)")

### Embed Badge

![Health badge](/badges/bonwe-bonwenium/health.svg)

```
[![Health](https://phpackages.com/badges/bonwe-bonwenium/health.svg)](https://phpackages.com/packages/bonwe-bonwenium)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k532.1M19.4k](/packages/laravel-framework)[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[spatie/flare-client-php

Send PHP errors to Flare

177156.9M21](/packages/spatie-flare-client-php)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

54642.4k4](/packages/jolicode-castor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
