後端測試和自動化

一、目錄

1、測試環境介紹與搭建

目的:能根據具體業務搭建環境

LAMP linux+apache+MySQL+PHP

2、Linux常用命令(《linux私房菜》)
ls
cd
awk
文本處理命令

3、MySQL常用命令
增刪改查
修改表結構
從數據庫把表copy到另一個DB

4、bingo框架
目的:獨立完成使用bingo框架開發的後端項目的測試任務

5、使用bingo框架的接口實例介紹

6、自動化測試框架phpunit
目的:編寫自動化case


二、測試環境介紹與搭建

1、四種常用WEB服務器的特點
(1)Apache:屬於重量級web服務器(重量級主要是在軟件包的大小上比較大,軟件的耦合度大),但是速度、性能不及其他輕量級web服務器,並且消費內存較高。使用傳統的select模型,比較穩定的Prefork模式爲多進程模式,需要經常派生子進程。所以消耗的cpu等服務器資源比較大。
(2)Lighttpd:輕量級web服務器,cpu佔用低,效能好,模塊豐富。
(3)Tomcat:運行:Servlet和Jsp web的應用軟件的容器,靜態和高併發處理弱。
(4)Nginx:輕量級,高性能http和反向代理服務器。高併發連接達到2-4萬個,內存、cpu等系統資源消耗低。Rewrite重寫規則(根據域名,URL的不同將HTTP請求分到不同的後端服務器羣組),內置的健康檢查功能(Nginx Proxy 後端的某臺web服務器宕機也不會影響前端訪問),節省帶寬(支持GZIP壓縮,可以添加瀏覽器本地緩存的Header頭)。

2、Lighttpd與apache區別
訪問純靜態對象時,Lighttpd速度更快、更理想;
Lighttpd吞吐量更大,能使用較少服務器提供與apache相同訪問量的服務;
Lighttpd具有非常低的性能開銷,cpu佔用率低。

3、Lighttpd的安裝與配置
下載:http://www.lighttpd.net/download/
從windows傳到linux上:rz -be
直接linux下載:
wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.37.tar.gz
tar -zxvf lighttpd-1.4.37.tar.gz
cd lighttpd-1.4.37
mv
安裝目錄 mkdir lighttpd_install 源碼目錄lighttpd-1.4.37
(1)編譯安裝Lighttpd: ./configure --prefix=安裝目錄 ./configure --prefix=/home/video/luna/lighttpd_install/必須絕對路徑
獲取pcre安裝包 http://www.pcre.org/  
解壓縮----mkdir pcre-install----./configure --prefix=/home/video/luna/pcre-install/----make----make install----cd ../pcre-install/bin/----pwd----vi ~/.bashrc ,把路徑添加進環境變量path後保存退出,再source ~/.bashrc ----cd ../..
繼續lighttpd的安裝:
cd lighttpd-1.4.37
./configure --prefix=/home/video/luna/lighttpd_install/
make
make install
將pcre添加環境變量:
vi ~/.bashrc
PATH=/home/video/luna/pcre_install/bin:$PATH
source ~/.bashrc
修改lighttpd配置文件
cd ../lighttpd_install/
mkdir config
cd config/
cp -r ../../lighttpd-1.4.37/doc/config/* .
比較重要的參數:
server.modules要加載的模塊
server.port 監聽端口(一般修改爲8000-9000的數值)
server.document-root 靜態文件和源文件目錄
url.rewrite-once url重寫:^/tools/\?(.*)"=>"/index.php?$1
vi lighttpd.config
設置路徑5個,修改到/home/video/luna/lighttpd_install/,log、config多一層目錄
include modules.conf 查看內容就3行,直接拷貝到lighttpd.config中方便查看( :sp modules.conf)
server.port = 8099
server.use-ipv6 = "disable"
server.username = "luna"
server.groupname = "uucun"
server.document-root = 
保存退出
啓動lighttpd
打開lighttpd_install/
mkdir log
mkdir config
mkdir htdocs
cd htdocs/
vi index.html 任意輸入內容後保存退出
重啓lighttpd:lighttpd_install/下,./sbin/lighttpd -f config/lighttpd.conf -m lib/
hostname -i獲得ip

在瀏覽器輸入ip/8099/index/html驗證是否成功搭建

4、php安裝與配置

(1)下載安裝包

wget http://museum.php.net/php5/php-5.2.17.tar.gz

wget http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz

發佈了23 篇原創文章 · 獲贊 7 · 訪問量 12萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章