日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

软件测试——实验六

發布時間:2025/3/15 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 软件测试——实验六 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、 實驗目的
應用Web測試工具對Web系統進行功能和性能測試;
二、實驗要求
1. 撰寫實驗報告;
2. 撰寫Web系統的測試計劃,測試方案;
3. 撰寫Web系統測試的測試用例;
4. 撰寫缺陷報告;
5. 提交測試腳本。
三、實驗內容
1.題目一:測試網站功能
選擇一個網站,對其進行功能測試。要求首先編寫測試用例,然后在mooctest平臺對該網站進行測試。
2.題目二:測試網站性能
選擇一個網站,對其進行性能測試。要求在mooctest平臺進行負載測試。
四、測試用例的編寫
1.功能測試用例設計
1)用例名稱:房屋租賃系統

2)前置條件:
(a)用戶已成功登錄系統;

3)測試步驟:




4)預期結果:完成操作
測試步驟
Selenium 腳本錄制
導出Junit測試
完善腳本

// Generated by Selenium IDE import org.junit.Test; import org.junit.Before; import org.junit.After; import static org.junit.Assert.*; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.core.IsNot.not; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.Dimension; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Alert; import org.openqa.selenium.Keys; import java.util.*; import java.net.MalformedURLException; import java.net.URL; public class Zhouri1Test {private WebDriver driver;private Map<String, Object> vars;JavascriptExecutor js;@Beforepublic void setUp() {driver = new ChromeDriver();js = (JavascriptExecutor) driver;vars = new HashMap<String, Object>();}@Afterpublic void tearDown() {driver.quit();}@Testpublic void zhouri1() {driver.get("http://114.215.176.95:60513/text2/");driver.manage().window().setSize(new Dimension(950, 824));driver.findElement(By.name("username")).click();driver.findElement(By.name("username")).sendKeys("admin");driver.findElement(By.name("password")).click();driver.findElement(By.name("password")).sendKeys("123456");driver.findElement(By.id("login-button")).click();driver.findElement(By.linkText("房源列表")).click();driver.findElement(By.linkText("修改")).click();driver.findElement(By.id("price")).click();driver.findElement(By.id("price")).sendKeys("700.0");driver.findElement(By.cssSelector(".btn-primary")).click();driver.findElement(By.linkText("添加房源")).click();driver.findElement(By.id("houseid")).click();driver.findElement(By.id("houseid")).sendKeys("a416");driver.findElement(By.id("houseid")).sendKeys("a415");driver.findElement(By.id("address")).click();driver.findElement(By.id("address")).sendKeys("下沙808號");driver.findElement(By.id("address")).click();driver.findElement(By.id("address")).sendKeys("下沙828號");driver.findElement(By.id("area")).click();driver.findElement(By.id("area")).sendKeys("78");driver.findElement(By.id("area")).sendKeys("789");driver.findElement(By.id("price")).click();driver.findElement(By.id("price")).sendKeys("700.0");driver.findElement(By.id("price")).click();driver.findElement(By.id("price")).sendKeys("7000.0");driver.findElement(By.id("status")).click();{WebElement dropdown = driver.findElement(By.id("status"));dropdown.findElement(By.xpath("//option[. = '未租賃']")).click();}driver.findElement(By.id("status")).click();driver.findElement(By.cssSelector(".btn-primary")).click();driver.findElement(By.linkText("在租列表")).click();driver.findElement(By.linkText("查看合同")).click();driver.findElement(By.cssSelector(".btn-primary")).click();driver.findElement(By.id("payday")).click();driver.findElement(By.id("payday")).sendKeys("3");driver.findElement(By.cssSelector(".btn-primary")).click();driver.findElement(By.linkText("我要收租")).click();driver.findElement(By.linkText("收租")).click();{WebElement element = driver.findElement(By.cssSelector(".btn-primary"));Actions builder = new Actions(driver);builder.moveToElement(element).perform();}driver.findElement(By.id("date")).click();driver.findElement(By.linkText("16")).click();driver.findElement(By.id("zuke")).click();driver.findElement(By.id("zuke")).sendKeys("700.0");driver.findElement(By.cssSelector(".btn-primary")).click();driver.findElement(By.linkText("租客已繳租金")).click();driver.findElement(By.id("zuname")).click();driver.findElement(By.id("zuname")).sendKeys("李四");driver.findElement(By.name("sub")).click();} }
  • 移除Junit并優化
  • 2.性能測試用例設計

    測試范圍
    對“房屋租賃系統”中的“租客已繳租金”的查詢功能進行性能測試,在測試過程中必須按要求對錄制的腳本進行修改(包括參數化、集合點、事務等)。
    1、創建名為 rentHouse 線程組(Thread Group),該線程組負責對房屋租賃系統-租客已繳租金查詢功能進行性能測試,相關的操作應放置在該線程組中。
    操作流程:
    i. 進入到房屋租賃系統-租金信息-租客已繳租金列表頁面;
    ii. 對租客姓名進行篩選;
    2、在該線程組處配置 50-100 個并發用戶和合適的 ramp up period,線程組執行時間為 1 分鐘。
    i. 注意:在使用 jmeter 自帶的run 功能時,不要使用超過 30 的線程數運行腳本, 否則會造成端口被封。正確流程是:

  • 使用較小線程數(10 以內)運行腳本和進行評分,保證除線程組以外的評分項獲得理想分數
  • 再調整線程組配置,然后直接進行評分,不使用 jmeter 自帶的 run 功能。請嚴格按照該注意事項進行操作,若造成端口被封,請換用其他 IP 和端口。如果還是不行,造成分數誤差,后果自負。
    3、對于這部分腳本,在關鍵的搜索請求處添加事務、參數化(對出發城市、到達城市,和去程時間做參數化,其他搜索字段不做要求),并在關鍵搜索請求處添加集合點。注意:
    i. 請使用 CSV 數據文件配置(CSV Data Set Config)進行參數化,不要使用_CSVRead 等方式;
    ii. 參數文件請使用 csv 格式;參數文件中最多包含 10 組數據即可,測試數據過多會導致評分速度過慢。
    iii. 請將參數文件和腳本文件放在同一級文件夾下,并在 CSV 數據文件配置(CSV Data Set Config)中使用相對地址作為參數文件名,如 data.csv,不需要在文件名前使用./。文件不在同級目錄、使用絕對地址、以及在文件名前使用./這三 種行為都會造成評分誤差;
    iv. 事務的位置、參數化的位置和集結線程數請自行配置
  • 2、整理腳本,保證腳本執行成功(若果存在.css 或圖片等的非關鍵鏈接執行失敗,可以刪除掉這部分鏈接)。

    3、腳本編寫有下面三種方法,選擇一種方法即可,推薦使用后兩種較為簡單的方法。這三種方式外的其他編寫方式可能會出現評分失敗的情況
    i. 使用瀏覽器的開發者工具捕獲 http 請求,并手動編寫腳本。
    ii. 使用 JMeter 客戶端自帶的錄制功能,在瀏覽器中安裝ApacheJMeterTemporaryRootCA.crt,錄制腳本
    iii. 使用 Badboy 進行腳本錄制后,通過 file -> Export to JMeter 得到腳本。





    六、測試文檔的撰寫
    1.測試計劃
    此次測試的目的就是檢查核心模塊功能是否正常,驗證系統性能是否滿足應用需求。這次測試的具體內容如下:
    (1) 功能測試
    在功能測試中,重點測試的是登錄模塊.
    (2)性能測試
    在性能測試中,需要測試不同負載下系統的表現,并獲得系統的響應能力、負載能力、吞吐量和資源利用率等性能指標。
    (3)測試工具

    用途 工具 生產廠商 版本
    功能測試
    性能測試
    (4)測試策略
    登錄模塊測試策略
    測試策略項 登錄模塊測試
    測試類型 功能測試
    測試技術
    測試通過/失敗標準
    特殊考慮
    登錄模塊并發性能測試
    測試策略項 登錄模塊并發測試
    測試技術
    測試通過/失敗標準
    特殊考慮

    七、心得與體會
    1、熟悉學會了selenium,jmeter,badboy等插件軟件使用
    2、學習掌握了性能測試、功能測試
    3、熟悉了調試能力
    4、進一步了解軟件測試

    總結

    以上是生活随笔為你收集整理的软件测试——实验六的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。