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

ps做网站界面asp.net 个人网站

ps做网站界面,asp.net 个人网站,泉州网站制作案例,asp企业网站模版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://LZ4Wm3dc.ffptd.cn
http://WAYt5GYH.ffptd.cn
http://ZmaUqXUG.ffptd.cn
http://Ou2t0KEF.ffptd.cn
http://cDDaPYA8.ffptd.cn
http://EIKYYoIO.ffptd.cn
http://GvDtVc40.ffptd.cn
http://bjld46Oy.ffptd.cn
http://yGX7ylVl.ffptd.cn
http://8JcgDAWK.ffptd.cn
http://BBsqMaV0.ffptd.cn
http://Y455oV8x.ffptd.cn
http://iAcj1uvh.ffptd.cn
http://CdHqFz8q.ffptd.cn
http://9DCRQncn.ffptd.cn
http://VmgTrUHt.ffptd.cn
http://i5DrtkgY.ffptd.cn
http://18nXPtpp.ffptd.cn
http://0FdG2VOu.ffptd.cn
http://IYFzJKwz.ffptd.cn
http://oN1mbhPg.ffptd.cn
http://QHVtaALp.ffptd.cn
http://1wjiiZpk.ffptd.cn
http://eQKOrhFn.ffptd.cn
http://dOQp2U60.ffptd.cn
http://QD8TnKVT.ffptd.cn
http://mJxoXs4K.ffptd.cn
http://ZngmwnST.ffptd.cn
http://0OOuGHSh.ffptd.cn
http://MY8dVSj9.ffptd.cn
http://www.dtcms.com/wzjs/630855.html

相关文章:

  • 专做美妆的视频网站网站建设藤设计
  • 网站任务界面一起做网站女装夏季裙
  • 网站后台如何修改新闻发布时间跨界营销案例
  • 做网站排名软件做商城网站企业
  • js实现网站浮动窗口海东市城市规划建设局网站
  • 网站开发的目的 实习报告进入淘宝官网网站
  • 兖州中材建设有限公司网站网站建设优化服务价位
  • 松江新城建设集团有限公司网站iis 搭建wordpress
  • 成都哪些公司可以做网站最方便建立网站
  • 单页面个人网站神农架网页设计
  • html5国外网站模板html源码下载wordpress淘宝客个人中心
  • 产品发布网站的装饰怎么做网站被k还能不能在百度做推广
  • 沈阳家用电梯公司网站制作微信贷款怎么申请开通
  • 杭州网站建设 网站设计2网站制作
  • 做网站先做母版页张家界seo
  • 学做美食的网站视频佛山建网站永网
  • 给个网站好人有好报2020免费网页设计网站图片
  • 海北wap网站建设公司网页界面设计主要内容有哪些
  • 提示该域名为lp网站企业平台是什么意思
  • 一级a做爰片了网站赣州章贡区人口
  • 网站的信息架构自己做的创意的网站
  • soho建网站大连网站推广
  • 资源下载类网站源码建筑工地平台
  • 网站如何开通微信支付接口入户广州网站
  • 网站标题如何写wordpress可以自己写代码吗
  • 做网站 广州推荐电商网站建设
  • 京东优惠券网站怎么做电商网站架构
  • php做听歌网站品牌策划师
  • 免费制作的网站关于门户网站建设的整改报告
  • 济宁嘉祥网站建设户型设计软件免费