The high automation framework.
tsbxmw@ps# pip install haf --upgrade
tsbxmw@ps# git clone https://github.com/tsbxmw/haf
tsbxmw@ps# cd haf
tsbxmw@ps# python setup.py install
python -m haf init
or
git clone https://github.com/tsbxmw/haf-sample
python -m haf run -c=config.json
python -m haf run -c=config-web.json
using chrome or other browsers to open the html file
quick start | haf-sample | pypi | read the doc |
---|---|---|---|
start | haf-sample | pypi | doc |
id | plugin name | version | git hub repo |
---|---|---|---|
1 | haf api server | haf webserver | |
2 | haf sql publish | haf sqlpublish |
- local bus is without --bus-server(-bs) args, when running the program, the bus would be created
- change the
log_path
andreport_path
andcase_path
to your own path - delete
config->run->sql_publish
if you don't have an haf-publish
{
"config":{
"name": "test",
"debug" : false,
"bus_server_port": 8801,
"run": {
"sql_publish": {
"id": 1,
"sql_name": "upload",
"publish": true,
"host": "192.168.0.200",
"port": 3306,
"username": "root",
"password": "root",
"database": "haf_publish",
"protocol": "mysql"
},
"log": {
"log_path": "./data"
},
"bus": {
"only": false,
"host": "",
"port": "",
"auth_key": ""
},
"report": {
"report_path": "./data/report.html",
"report_template": "base",
"report_export_path": "email"
},
"case": [
{
"case_path": "./testcases/test.xlsx"
},
{
"case_path": "./testcases/test2.json"
},
{
"case_path": "./testcases/test1.xlsx"
},
{
"case_path": "./testcases/test3.yml"
}
],
"runner":{
"only": false,
"count": 4
},
"loader": {
"only": false
},
"recorder": {
"only": false
},
"web_server": {
"host": "",
"port": "",
"run": true
}
}
}
}
- create xlsx/json/yml/py file with template in testcases/
- using haf-sample case template
python -m haf run -c=./testcases/config.json
python -m haf run -case=./testcases/test.xlsx,./testcases/test2.json -ld=./data -rh=true -rod=./data/report.html
- change the config.json's "report" to add report_template
"run": {
"type": "app" # change type to app
"report": {
"report_template": "base_app", # change report_template to base_app
"report_path": "./data/report.html"
}
}
- change the config.json's "report" to add report_template
"run": {
"type": "web" # change type to web
"report": {
"report_template": "base_web", # change report_template to base_web
"report_path": "./data/report.html"
}
}
- run with multi-runners (4 runners)
python -m haf run -rc=4
- run with web server
python -m haf run -ws=true
- run with only-mode
# only loader
python -m haf run -ol=true
# only bus
python -m haf run -ob=true
# only runner
python -m haf run -or=true
# only recorder
python -m haf run -ore=true
- run with third report template
"report": {
"report_template": "base_app"
}
- run with mysql publish
"sql_publish": {
"id": 1,
"sql_name": "upload",
"publish": true,
"host": "192.168.0.200",
"port": 3306,
"username": "root",
"password": "root",
"database": "haf_publish",
"protocol": "mysql"
}
tsbx# pip install hafweb -U
python -m hafweb -ss=root:root@localhost:3306@haf_publish -p=8081
-
default page
-
index page
-
today page
-
others support looking at hafweb project
- get loader infos
http://localhost:8888/loader
- get runner infos
http://localhost:8888/runner
- get result infos
http://localhost:8888/result
- get report infos
http://localhost:8888/report
http://localhost:8888/report-app
-
now support app-ui/web-ui cases and generate report
-
support mysql result publish
-
based on local test runners
-
support xlsx,json,yml,py cases
-
report generate with html-template
-
multi-processes on different machines
-
multi-runners
-
web-server support restful api based on flask
-
only mode : loader/runner/recorder/webserver/bus/logger support