当前位置: 首页 > wzjs >正文

中国建设银行手机银行网站怀化网站制作建设

中国建设银行手机银行网站,怀化网站制作建设,加强心理咨询网站的建设方案,新素材网站Author:MTingle major:人工智能 Build your hopes like a tower! 目录 一.项目简介 二.开发技术 三.测试用例设计 四.自动化测试代码 common包 博客编辑 博客列表 登录页面 未登录测试 主函数 五.测试总结 一.项目简介 该项目是一款基于 SSM 框架搭建的…

  Author:MTingle
major:人工智能


Build your hopes like a tower!


目录

一.项目简介

二.开发技术

三.测试用例设计

四.自动化测试代码

common包

博客编辑

博客列表

登录页面

未登录测试

主函数

五.测试总结


一.项目简介

该项目是一款基于 SSM 框架搭建的个人博客系统。该系统依托 SSM 框架强大的稳定性和灵活性,实现了用户管理、文章发布等核心功能。用户可便捷注册登录,随心发布文章,分享生活感悟与专业见解。

二.开发技术

SpringBoot、SpringMVC、MyBatis、Token、MD5等。

三.测试用例设计


四.自动化测试代码

common包
package common;import io.github.bonigarcia.wdm.WebDriverManager;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.Duration;public class Utils {public static WebDriver driver;public static WebDriver createDriver(){if(driver == null){WebDriverManager.chromedriver().setup();ChromeOptions options = new ChromeOptions();//允许访问所有的链接options.addArguments("--remote-allow-origins=*");driver = new ChromeDriver(options);//等待driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(2));}return driver;}public Utils(String url){//调用driver对象driver = createDriver();//访问urldriver.get(url);}public void getScreenShot(String str) throws IOException {//     ./src/test/image///                     /2024-07-17///                                /test01-17453010.png//                                /test02-17453020.png//                     /2024-07-18///                                /test01-17453030.png//                                /test02-17453034.png//屏幕截图SimpleDateFormat sim1 = new SimpleDateFormat("yyyy-MM-dd");SimpleDateFormat sim2 = new SimpleDateFormat("HHmmssSS");String dirTime = sim1.format(System.currentTimeMillis());String fileTime = sim2.format(System.currentTimeMillis());//./src/test/image/2024-07-17/test01-17453020.pngString filename ="./src/test/image/"+ dirTime +"/" + str + "-" + fileTime+".png";File srcFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);//srcFile放到指定位置FileUtils.copyFile(srcFile,new File(filename));}
}
博客编辑
ackage tests;import common.Utils;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.WebDriverWait;import java.security.Key;
import java.time.Duration;public class EditPage extends Utils {public static String url = "http://8.137.19.140:9090/blog_edit.html";public EditPage() {super(url);}public void EditSuc() throws InterruptedException {String blogTile = "测试开发";driver.findElement(By.cssSelector("#title")).sendKeys(blogTile);WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(2));//第二种方法实现----下节课再讲
//        1.鼠标先挪动到博客内容区域
//        2.双击鼠标将内容删掉:鼠标双击内容+键盘DELETE
//        3.输入内容WebElement ele = driver.findElement(By.cssSelector("#editor > div.CodeMirror.cm-s-default.CodeMirror-wrap > div.CodeMirror-scroll > div.CodeMirror-sizer > div > div > div > div.CodeMirror-code > div > pre > span > span"));Actions actions = new Actions(driver);//perform作用:为了在页面看到效果Thread.sleep(1000);actions.doubleClick(ele).perform();Thread.sleep(1000);actions.sendKeys(Keys.DELETE).perform();// 输入新内容actions.sendKeys("键盘输入测试开发").perform();Thread.sleep(1000);driver.findElement(By.cssSelector("#submit")).click();Thread.sleep(3000);driver.quit();}}
博客列表
package tests;import common.Utils;
import jdk.jshell.execution.Util;
import org.openqa.selenium.Alert;import java.util.List;public class ListPage extends Utils {public static String url = "http://8.137.19.140:9090/blog_list.htmlq";public ListPage() {super(url);}/*** 未登录状态下访问列表页*/public void listNoLogin(){// 处理警告弹窗Alert alert = driver.switchTo().alert();alert.accept();// 调整到登录页面String expect = driver.getTitle();assert expect.equals("登录页面");}}
登录页面
package tests;import common.Utils;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;import java.io.IOException;
import java.time.Duration;public class LoginPage extends Utils {public static String url = "http://8.137.19.140:9090/blog_login.html";public LoginPage() {super(url);}public void loginPageRight(){// 通过查找元素判断页面加载成功与否driver.findElement(By.cssSelector("body > div.nav > a:nth-child(5)"));driver.findElement(By.cssSelector("body > div.container-login > div"));}public void loginSuc() throws IOException {// 通过查找元素判断页面加载成功与否driver.findElement(By.cssSelector("#username")).sendKeys("zhangsan");driver.findElement(By.cssSelector("#password")).sendKeys("123456");driver.findElement(By.cssSelector("#submit")).click();// 检查是否登录成功: 通过检查是否存在 "查看全文" 按钮判断是否登录成功driver.findElement(By.cssSelector("body > div.container > div.right > div:nth-child(1) > a"));// 页面标题判断是否登录成功String expect = driver.getTitle();assert expect.equals("博客列表页");
//        getScreenShot(getClass().getName());
//        assert expect.equals("博客列表111");//        driver.quit();}/*** 登录失败: 显示等待处理弹窗*/public void loginFail() throws IOException {driver.navigate().back();// 通过 clear 保证输入框没有文本信息driver.findElement(By.cssSelector("#username")).clear();driver.findElement(By.cssSelector("#password")).clear();// 通过查找元素判断页面加载成功与否driver.findElement(By.cssSelector("#username")).sendKeys("zhangsan111");driver.findElement(By.cssSelector("#password")).sendKeys("123456");driver.findElement(By.cssSelector("#submit")).click();// 检查是否登录成功: 通过检查是否存在 "查看全文" 按钮判断是否登录成功
//        driver.findElement(By.cssSelector("body > div.container > div.right > div:nth-child(1) > a"));
//        getScreenShot(getClass().getName());WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));try {Alert alert = wait.until(ExpectedConditions.alertIsPresent());alert.accept();} catch (Exception e) {System.out.println("等待5秒后仍未检测到弹窗");}// 页面标题判断是否登录成功String expect = driver.getTitle();System.out.println(expect);
//        assert expect.equals("博客列表");
//        assert expect.equals("博客列表111");driver.quit();}}
未登录测试
package tests;import common.Utils;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;import java.io.IOException;public class PageByNoLogin extends Utils {public static String listurl = "http://8.137.19.140:9090/blog_list.html";public static String editurl = "http://8.137.19.140:9090/blog_edit.html";public static String detailurl = "http://8.137.19.140:9090/blog_detail.html";public PageByNoLogin() {super("");}// 列表页未登录处理public void listNoLogin() throws IOException {driver.get(listurl);Alert alert = driver.switchTo().alert();alert.accept();String expect = driver.getTitle();getScreenShot(getClass().getName());assert expect.equals("博客登录页");}public void detailNoLogin() throws IOException {driver.get(detailurl);Alert alert = driver.switchTo().alert();alert.accept();String expect = driver.getTitle();getScreenShot(getClass().getName());assert expect.equals("博客登录页");}public void editNoLogin() throws IOException {driver.get(editurl);Alert alert = driver.switchTo().alert();alert.accept();String expect = driver.getTitle();getScreenShot(getClass().getName());assert expect.equals("博客登录页");}}
主函数
package tests;import java.io.IOException;public class RunTests {public static void main(String[] args) throws IOException, InterruptedException {LoginPage login = new LoginPage();
//        login.loginPageRight();login.loginSuc();
//        login.loginFail();EditPage editPage = new EditPage();editPage.EditSuc();//        ListPage listPage = new ListPage();}
}

五.测试总结

1) 主功能测试通过,项目可以上线
2) 项目上线后高优观察线上数据,查看线上用户操作日志,及时跟进用户反馈。


文章转载自:

http://PumVlu6Z.tztgq.cn
http://rFiARySM.tztgq.cn
http://L22HEj0i.tztgq.cn
http://27tI4iD8.tztgq.cn
http://EQhBSrIn.tztgq.cn
http://pDVXfzAW.tztgq.cn
http://JgMbPIuF.tztgq.cn
http://H5E91giV.tztgq.cn
http://hssd309j.tztgq.cn
http://4N4oS3Qn.tztgq.cn
http://N8MGDbta.tztgq.cn
http://FsJ2YoM1.tztgq.cn
http://vScWlfld.tztgq.cn
http://SUHtvkWj.tztgq.cn
http://SsCh6qik.tztgq.cn
http://hM0WSuBK.tztgq.cn
http://uLNqbRSl.tztgq.cn
http://28LxuWNh.tztgq.cn
http://NeLubwXQ.tztgq.cn
http://PdYtrpIX.tztgq.cn
http://oX1rP2oF.tztgq.cn
http://3Fym3Jgi.tztgq.cn
http://sGGuFQPW.tztgq.cn
http://QQqlb3kf.tztgq.cn
http://VQypVoon.tztgq.cn
http://MRfgH8My.tztgq.cn
http://BVZdx5Kl.tztgq.cn
http://fjPyWwpX.tztgq.cn
http://LzjpVU7Q.tztgq.cn
http://GwQVickP.tztgq.cn
http://www.dtcms.com/wzjs/706644.html

相关文章:

  • 什么是网站降权处理wordpress不能选择数据库
  • 集约化网站建设情况深圳做网站什么公司好
  • 类似美团的网站建设如何不用代码做网站
  • 自己动手做网站shafow网站是谁做的
  • 学校网站建设的背景wordpress 很慢
  • 自己用电脑网站建设wordpress购物网站手机
  • 做外贸营销网站销售咋样新闻页面设计
  • 刘涛给孩子网站做的广告网站建设个人主要事迹
  • 怎么做网站筛选功能如何跟进网站建设的客户
  • 弹窗网站制作批量入侵wordpress
  • 做网站植入广告赚钱网站10月份可以做哪些有意思的专题
  • 公司网站免费建站怎么样合肥道路建设从哪个网站可以看到
  • 网站所属权合江网站建设
  • 在网站用什么做页面布局网页设计公司的目标客户有哪些
  • 百度网站怎么做的网站 易用性原则
  • 做印刷哪个网站好公司的帐如何做网站
  • 广东省建筑网站贵州交通建设集团
  • 枣庄网站制作公司div做网站排版
  • 自己如何做网站关键词排名山东银汇建设集团网站
  • 正邦做网站吗做动态效果的插件网站
  • 做外贸怎样上国外网站做电子签章登录哪个网站
  • 关于购物网站开发的开题报告无锡网站建设无锡网络推广
  • 个人小型网站建设如何投诉做网站的公司
  • 做网站默认城市wordpress微信群导航模板
  • 模特公司网站模板网络专题的设计策划方案
  • 网站建设的一些背景图片建筑公司资质等级
  • 南宁网站建设技术支持海南注册家族公司条件
  • 在哪里可以找到网站响应式网站无法做联盟广告
  • 网站备案多长时间来完成电子商务网上法庭
  • 网站建设责任分工表长沙网页制作模板