FunkLoad包装说明
FunkLoad是一个功能和负载网络测试仪,用Python编写的,其主要用例有:
- Web项目的功能测试,从而回归测试也是如此。
- 性能测试:通过加载Web应用程序和监控服务器它可以帮助你找出瓶颈,给性能测试的详细报告。
- 负载测试工具,揭露错误不粗略测试中,如音量测试或寿命测试。
- 压力测试工具,以压倒Web应用程序资源和测试应用程序的可恢复性。
- 通过脚本任何网络重复性任务编写web代理。 资料来源:http://funkload.nuxeo.org/intro.html
- 作者:伯努瓦Delbosc,Nuxeo的SAS
许可:GPL第二版
0x01 包含在funkload包工具
FL-记录 - 启动一个TCPWatch代理和记录活动
:~# fl-record -h Usage ===== fl-record [options] [test_name] fl-record launch a TCPWatch proxy and record activities, then output a FunkLoad script or generates a FunkLoad unit test if test_name is specified. The default proxy port is 8090. Note that tcpwatch.py executable must be accessible from your env. See http://funkload.nuxeo.org/ for more information. Examples ======== fl-record foo_bar Run a proxy and create a FunkLoad test case, generates test_FooBar.py and FooBar.conf file. To test it: fl-run-test -dV test_FooBar.py fl-record -p 9090 Run a proxy on port 9090, output script to stdout. fl-record -i /tmp/tcpwatch Convert a tcpwatch capture into a script. Options ======= --version show program's version number and exit --help, -h show this help message and exit --verbose, -v Verbose output --port=PORT, -p PORT The proxy port. --tcp-watch-input=TCPWATCH_PATH, -i TCPWATCH_PATH Path to an existing tcpwatch capture. --loop=LOOP, -l LOOP Loop mode.
0x02 FL-凭证-CTL - 在XML / RPC服务器上执行动作
:~# fl-credential-ctl -h Usage ===== fl-credential-ctl config_file action action can be: start|startd|stop|restart|status|test Execute action on the XML/RPC server. Options ======= --version show program's version number and exit --help, -h show this help message and exit --quiet, -q Verbose output
0x03 FL-运行测试 - 启动一个FunkLoad单元测试
:~# fl-run-test -h Usage ===== fl-run-test [options] file [class.method|class|suite] [...] fl-run-test launch a FunkLoad unit test. A FunkLoad unittest use a configuration file named [class].conf, this configuration is overriden by the command line options. See http://funkload.nuxeo.org/ for more information. Examples ======== fl-run-test myFile.py Run all tests (including doctest with python2.4). fl-run-test myFile.py test_suite Run suite named test_suite. fl-run-test myFile.py MyTestCase.testSomething Run a single test MyTestCase.testSomething. fl-run-test myFile.py MyTestCase Run all 'test*' test methods and doctest in MyTestCase. fl-run-test myFile.py MyTestCase -u http://localhost Same against localhost. fl-run-test myDocTest.txt Run doctest from plain text file (requires python2.4). fl-run-test myDocTest.txt -d Run doctest with debug output (requires python2.4). fl-run-test myfile.py -V Run default set of tests and view in real time each page fetch with firefox. fl-run-test myfile.py MyTestCase.testSomething -l 3 -n 100 Run MyTestCase.testSomething, reload one hundred time the page 3 without concurrency and as fast as possible. Output response time stats. You can loop on many pages using slice -l 2:4. fl-run-test myFile.py -e [Ss]ome Run all tests that match the regex [Ss]ome. fl-run-test myFile.py -e '!xmlrpc$' Run all tests that does not ends with xmlrpc. fl-run-test myFile.py --list List all the test names. fl-run-test -h More options. Options ======= --version show program's version number and exit --help, -h show this help message and exit --quiet, -q Minimal output. --verbose, -v Verbose output. --debug, -d FunkLoad and doctest debug output. --debug-level=DEBUG_LEVEL Debug level 3 is more verbose. --url=MAIN_URL, -u MAIN_URL Base URL to bench without ending '/'. --sleep-time-min=FTEST_SLEEP_TIME_MIN, -m FTEST_SLEEP_TIME_MIN Minumum sleep time between request. --sleep-time-max=FTEST_SLEEP_TIME_MAX, -M FTEST_SLEEP_TIME_MAX Maximum sleep time between request. --dump-directory=DUMP_DIR Directory to dump html pages. --firefox-view, -V Real time view using firefox, you must have a running instance of firefox in the same host. --no-color Monochrome output. --loop-on-pages=LOOP_STEPS, -l LOOP_STEPS Loop as fast as possible without concurrency on pages, expect a page number or a slice like 3:5. Output some statistics. --loop-number=LOOP_NUMBER, -n LOOP_NUMBER Number of loop. --accept-invalid-links Do not fail if css/image links are not reachable. --simple-fetch Don't load additional links like css or images when fetching an html page. --stop-on-fail Stop tests on first failure or error. --regex=REGEX, -e REGEX The test names must match the regex. --list Just list the test names. --pause Pause between request, press ENTER to continue.
0x04 FL-集结报告 - 分析FunkLoad板凳XML结果文件和输出报表
:~# fl-build-report -h Usage ===== fl-build-report [options] xmlfile [xmlfile...] or fl-build-report --diff REPORT_PATH1 REPORT_PATH2 fl-build-report analyze a FunkLoad bench xml result file and output a report. If there are more than one file the xml results are merged. See http://funkload.nuxeo.org/ for more information. Examples ======== fl-build-report funkload.xml ReST rendering into stdout. fl-build-report --html -o /tmp funkload.xml Build an HTML report in /tmp fl-build-report --html node1.xml node2.xml node3.xml Build an HTML report merging test result from 3 nodes. fl-build-report --diff /tmp/test_reader-20080101 /tmp/test_reader-20080102 Build a differential report to compare 2 bench reports, requires gnuplot. fl-build-report -h More options. Options ======= --version show program's version number and exit --help, -h show this help message and exit --html, -H Produce an html report. --with-percentiles, -P Include percentiles in tables, use 10%, 50% and 90% for charts, default option. --no-percentiles No percentiles in tables display min, avg and max in charts (gdchart only). --diff, -d Create differential report. --output-directory=OUTPUT_DIR, -o OUTPUT_DIR Parent directory to store reports, the directoryname of the report will be generated automatically. --report-directory=REPORT_DIR, -r REPORT_DIR Directory name to store the report. --apdex-T=APDEX_T, -T APDEX_T Apdex T constant in second, default is set to 1.5s. Visit http://www.apdex.org/ for more information.
0x05 fl-run-bench – Launch a FunkLoad unit test as load test
0x06
:~# fl-run-bench -h Usage ===== fl-run-bench [options] file class.method fl-run-bench launch a FunkLoad unit test as load test. A FunkLoad unittest use a configuration file named [class].conf, this configuration is overriden by the command line options. See http://funkload.nuxeo.org/ for more information. Examples ======== fl-run-bench myFile.py MyTestCase.testSomething Bench MyTestCase.testSomething using MyTestCase.conf. fl-run-bench -u http://localhost:8080 -c 10:20 -D 30 myFile.py \ MyTestCase.testSomething Bench MyTestCase.testSomething on localhost:8080 with 2 cycles of 10 and 20 users during 30s. fl-run-bench -h More options. Options ======= --version show program's version number and exit --help, -h show this help message and exit --url=MAIN_URL, -u MAIN_URL Base URL to bench. --cycles=BENCH_CYCLES, -c BENCH_CYCLES Cycles to bench, this is a list of number of virtual concurrent users, to run a bench with 3 cycles with 5, 10 and 20 users use: -c 2:10:20 --duration=BENCH_DURATION, -D BENCH_DURATION Duration of a cycle in seconds. --sleep-time-min=BENCH_SLEEP_TIME_MIN, -m BENCH_SLEEP_TIME_MIN Minimum sleep time between requests. --sleep-time-max=BENCH_SLEEP_TIME_MAX, -M BENCH_SLEEP_TIME_MAX Maximum sleep time between requests. --test-sleep-time=BENCH_SLEEP_TIME, -t BENCH_SLEEP_TIME Sleep time between tests. --startup-delay=BENCH_STARTUP_DELAY, -s BENCH_STARTUP_DELAY Startup delay between thread. --as-fast-as-possible, -f Remove sleep times between requests and between tests, shortcut for -m0 -M0 -t0 --no-color Monochrome output. --accept-invalid-links Do not fail if css/image links are not reachable. --simple-fetch Don't load additional links like css or images when fetching an html page. --label=LABEL, -l LABEL Add a label to this bench run for easier identification (it will be appended to the directory name for reports generated from it). --enable-debug-server Instantiates a debug HTTP server which exposes an interface using which parameters can be modified at run-time. Currently supported parameters: /cvu?inc=<integer> to increase the number of CVUs, /cvu?dec=<integer> to decrease the number of CVUs, /getcvu returns number of CVUs --debug-server-port=DEBUGPORT Port at which debug server should run during the test
0x07 fl-monitor-ctl – Execute action on the XML/RPC server
:~# fl-monitor-ctl -h Usage ===== fl-monitor-ctl config_file action action can be: start|startd|stop|restart|status|test Execute action on the XML/RPC server. Options ======= --version show program's version number and exit --help, -h show this help message and exit --quiet, -q Verbose output
0x08 FunkLoad Usage Example
:~# coming soon
原文来自:https://www.hackfun.org/kali-tools/funkload_zh.html。转载请注明原出处,商用请联系原作者授权。