《電子技術(shù)應(yīng)用》
您所在的位置:首頁 > 其他 > 設(shè)計(jì)應(yīng)用 > 一種基于Selenium與Unittest的Web自動(dòng)化測試框架
一種基于Selenium與Unittest的Web自動(dòng)化測試框架
信息技術(shù)與網(wǎng)絡(luò)安全
單攀攀
(上海維也知科技責(zé)任有限公司,上海201106)
摘要: 由于產(chǎn)品需求的頻繁變更或功能缺陷的不斷迭代,出現(xiàn)了大量的軟件回歸測試中占用測試人力資源來保證產(chǎn)品質(zhì)量的現(xiàn)象。針對這一現(xiàn)象,設(shè)計(jì)并實(shí)現(xiàn)了一種基于Selenium與Uunittest的Web自動(dòng)化測試框架。使用基于Python的Unittest測試框架,能夠非常容易地插入、設(shè)置與分解相關(guān)的測試功能。同時(shí)結(jié)合了Selenium,把常用的操作和查找封裝成基礎(chǔ)類,針對不同的產(chǎn)品或項(xiàng)目,可直接復(fù)用。使用該自動(dòng)化測試架構(gòu),不僅減少了回歸測試的人力成本,也減少了對測試人員在自動(dòng)化測試開發(fā)腳本能力的要求。
中圖分類號(hào): TP311.5
文獻(xiàn)標(biāo)識(shí)碼: A
DOI: 10.19358/j.issn.2096-5133.2021.09.013
引用格式: 單攀攀. 一種基于Selenium與Unittest的Web自動(dòng)化測試框架[J].信息技術(shù)與網(wǎng)絡(luò)安全,2021,40(9):77-80.
An web automated testing framework based on unittest and selenium
Shan Panpan
(Shanghai Wei Yi Zhi Technology Limited Liability Company,Shanghai 201106,China)
Abstract: Due to the frequent changes of product requirements or the continuous iterations of functional defects, a large number of software regression testing take up testing human resources to ensure product quality. In view of this phenomenon, this paper designs and implements an web automated testing framework based on selenium and unittest. Using the Python based unittest test framework, it is very easy to insert and set the test functions related to decomposition. Combined with selenium, this test architecture encapsulates common operations and searches into basic classes, which can be reused directly no matter what product or project it is. The use of this automated testing architecture not only reduces the human cost of regression testing, but also reduces the requirements of testers for automated test development script ability.
Key words : Unittest;Selenium;autotest platform

0 引言

軟件測試是為了提高軟件系統(tǒng)可靠性,保障軟件系統(tǒng)質(zhì)量而存在。IEEE、ACM等組織制定了一系列的軟件測試流程標(biāo)準(zhǔn)。Carnegie Mellon主要進(jìn)行了基于關(guān)鍵字驅(qū)動(dòng)模型自動(dòng)化測試的研究[1]。伴隨著互聯(lián)網(wǎng)技術(shù)的發(fā)展和自動(dòng)化測試工具與方法的不斷完善和擴(kuò)展,自動(dòng)化測試技術(shù)越來越成為了當(dāng)前軟件工程領(lǐng)域的熱門研究方向之一。

現(xiàn)今越來越多的企業(yè)應(yīng)用在使用B/S架構(gòu)[2](即Web),B/S架構(gòu)解決了C/S架構(gòu)存在的部分問題,不僅沒有客戶端的差異,而且用戶只需要安裝瀏覽器,不需要再額外安裝客戶端應(yīng)用。假如應(yīng)用的業(yè)務(wù)需求有所變更,僅僅將服務(wù)器端的應(yīng)用程序進(jìn)行更新即可。另外,客戶端應(yīng)用將不會(huì)受限于操作系統(tǒng)的區(qū)別,當(dāng)前主流的瀏覽器往往在多種操作系統(tǒng)下都有對應(yīng)的版本可供使用。

隨著市場Web應(yīng)用的不斷擴(kuò)充,Web平臺(tái)的自動(dòng)化測試或?yàn)檐浖詣?dòng)化測試的主要組成內(nèi)容,目前軟件行業(yè)也在該方面取得了一些研究碩果。Throught Works公司研發(fā)了一系列開源的Selenium Web平臺(tái)的功能測試工具集,普遍應(yīng)用于各式各樣的Web平臺(tái)自動(dòng)化測試,其中特性不僅具有方便擴(kuò)展、可跨平臺(tái),還可支持多瀏覽器等。Selenium被諸多自動(dòng)化Web測試框架所使用,最近幾年來已有眾多基于Selenium的Web自動(dòng)化測試框架的研究成果逐漸被引起重視[3-4]。

在實(shí)際應(yīng)用和實(shí)施過程中,自動(dòng)化測試的框架與方法使用的越優(yōu)良,其長期應(yīng)用所取得的收益也就越顯著。其中自動(dòng)化測試的核心技術(shù)主要是設(shè)計(jì)與使用自動(dòng)化測試框架,不適用的測試框架不能順利開展良好的自動(dòng)化測試,即造成人力成本輸出,也不能保障產(chǎn)品質(zhì)量。



本文詳細(xì)內(nèi)容請下載:http://ihrv.cn/resource/share/2000003770




作者信息:

單攀攀

(上海維也知科技責(zé)任有限公司,上海201106)




微信圖片_20210517164139.jpg

此內(nèi)容為AET網(wǎng)站原創(chuàng),未經(jīng)授權(quán)禁止轉(zhuǎn)載。