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

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > windows >内容正文

windows

功能测试——房屋租赁系统(Selenium IDE)

發(fā)布時(shí)間:2024/10/5 windows 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 功能测试——房屋租赁系统(Selenium IDE) 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

源代碼:https://gitee.com/shentuzhigang/mini-project/tree/master/test-house-rental

測(cè)試需求

  • 打開(kāi)瀏覽器(請(qǐng)用 Google 或 者 Firefox ,其他瀏覽器會(huì)產(chǎn)生樣式不適配) 輸入:http://114.215.176.95:60513/text2/ ,以管理員身份登錄賬號(hào) admin,密碼 123456
  • 管理員:賬號(hào) admin,密碼 123456
    租客:賬號(hào) 空格,密碼 空格

  • 點(diǎn)擊左側(cè)菜單欄查看房源列表,任意選擇一個(gè)房屋點(diǎn)擊修改按鈕

  • 修改房源信息: 修改租賃價(jià)格為 700.0,完成后點(diǎn)擊提交

  • 在上面同一位置,添加房源信息

  • 合理化輸入房屋 ID、地址、面積、租金、狀態(tài)選擇未租賃,點(diǎn)擊提交

  • 點(diǎn)擊左側(cè)菜單欄租賃及合同信息選項(xiàng)下的在租列表,選擇任一一個(gè)合同,點(diǎn)擊查看合同,進(jìn)入合同詳情頁(yè)面

  • 修改合同,每月交租日改為 2,點(diǎn)擊修改按鈕提交。

  • 點(diǎn)擊租金信息下的我要收租選項(xiàng),選擇任一房屋,點(diǎn)擊收租查看詳情

  • 點(diǎn)擊菜單欄租客已繳租金,輸入姓名李四,查詢租客信息

  • 點(diǎn)擊退出登錄按鈕,測(cè)試結(jié)束

  • 測(cè)試步驟

  • Selenium 腳本錄制
  • 導(dǎo)出Junit測(cè)試
  • 完善腳本
  • // 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 Test1Test {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 test1() {driver.get("http://114.215.176.95:60513/text2/");driver.manage().window().setSize(new Dimension(1552, 840));driver.findElement(By.name("username")).click();driver.findElement(By.name("username")).sendKeys("admin");driver.findElement(By.name("password")).sendKeys("123456");driver.findElement(By.id("login-button")).click();driver.findElement(By.cssSelector(".container")).click();driver.findElement(By.linkText("房源列表")).click();driver.findElement(By.cssSelector("tr:nth-child(3) .link-update")).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("a10086");driver.findElement(By.id("address")).click();driver.findElement(By.id("address")).sendKeys("615黃記煌三汁燜鍋");driver.findElement(By.id("area")).click();driver.findElement(By.id("area")).sendKeys("1000000000000000000000000000000000000000000000000000000000000");driver.findElement(By.id("price")).click();driver.findElement(By.id("price")).sendKeys("700.0");driver.findElement(By.cssSelector("tr:nth-child(5) > td")).click();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.name("hetong")).click();driver.findElement(By.cssSelector(".btn-primary")).click();driver.findElement(By.cssSelector("tr:nth-child(10)")).click();driver.findElement(By.id("payday")).sendKeys("2");driver.findElement(By.cssSelector(".btn-primary")).click();driver.findElement(By.linkText("我要收租")).click();driver.findElement(By.linkText("收租")).click();driver.findElement(By.cssSelector("tr:nth-child(2) > td")).click();driver.findElement(By.id("address")).click();driver.findElement(By.id("address")).click();driver.findElement(By.id("date")).click();driver.findElement(By.linkText("11")).click();driver.findElement(By.id("zuke")).click();driver.findElement(By.id("zuke")).sendKeys("700.0");driver.findElement(By.cssSelector(".btn-primary")).click();} }
  • 移除Junit并優(yōu)化
  • package io.shentuzhigang.test.houserental;import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.By; 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; /*** @author ShenTuZhiGang* @version 1.0.0* @email 1600337300@qq.com* @date 2021-06-20 15:00*/ public class Example {// Mooctest Selenium Example// <!> Check if selenium-standalone.jar is added to build path.public static void test(WebDriver driver) {// TODO Test script// eg:driver.get("https://www.baidu.com/")// eg:driver.findElement(By.id("wd"));driver.get("http://114.215.176.95:60513/text2/");driver.manage().window().setSize(new Dimension(1552, 840));driver.findElement(By.name("username")).sendKeys("admin");driver.findElement(By.name("password")).sendKeys("123456");driver.findElement(By.id("login-button")).click();driver.findElement(By.cssSelector(".container")).click();driver.findElement(By.linkText("房源列表")).click();driver.findElement(By.linkText("修改")).click();driver.findElement(By.id("price")).clear();driver.findElement(By.id("price")).sendKeys("700");driver.findElement(By.cssSelector(".btn-primary")).click();driver.findElement(By.linkText("添加房源")).click();driver.findElement(By.id("houseid")).sendKeys("a100861");driver.findElement(By.id("address")).sendKeys("615黃記煌三汁燜鍋");driver.findElement(By.id("area")).sendKeys("1000");driver.findElement(By.id("price")).sendKeys("700.0");{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.linkText("查看合同")).click();driver.findElement(By.name("hetong")).click();driver.findElement(By.cssSelector(".btn-primary")).click();driver.findElement(By.cssSelector("tr:nth-child(10)")).click();driver.findElement(By.id("payday")).clear();driver.findElement(By.id("payday")).sendKeys("2");driver.findElement(By.cssSelector(".btn-primary")).click();driver.findElement(By.linkText("租客已繳租金")).click();driver.findElement(By.id("zuname")).sendKeys("cwy");driver.findElement(By.name("sub")).click();driver.findElement(By.linkText("我要收租")).click();driver.findElement(By.linkText("收租")).click();driver.findElement(By.id("date")).click();driver.findElement(By.linkText("11")).click();driver.findElement(By.id("zuke")).clear();driver.findElement(By.id("zuke")).sendKeys("700.0");driver.findElement(By.cssSelector(".btn-primary")).click();}public static void main(String[] args) {// Run main function to test your script.WebDriver driver = new ChromeDriver();try { test(driver); }catch(Exception e) { e.printStackTrace(); }finally { driver.quit(); }}}

    測(cè)試結(jié)果

    常見(jiàn)問(wèn)題

    Selenium3+MoocTest環(huán)境搭建常見(jiàn)問(wèn)題解決方案

    參考文章

    功能測(cè)試——醫(yī)療管理系統(tǒng)

    總結(jié)

    以上是生活随笔為你收集整理的功能测试——房屋租赁系统(Selenium IDE)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。