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

政府网站群集约化建设通知使用网站模板快速建站

政府网站群集约化建设通知,使用网站模板快速建站,如何做图让网站的图更清晰,如果自己做网站目录 一、项目概述 应用技术 接口实现: 数据库定义: 数据库建表: 博客表数据库相关操作: 添加项⽬公共模块 加密MD5 页面展示:http://121.41.168.121:8080/blog_login.html 项目源码:https://gitee…


目录

一、项目概述

应用技术

接口实现:

 数据库定义:

数据库建表:

博客表数据库相关操作:

添加项⽬公共模块

加密MD5

页面展示:http://121.41.168.121:8080/blog_login.html

 项目源码:https://gitee.com/li-dot/blogs

二、对博客系统进行自动化测试

测试用例图Docs

 使用Selenium进行测试


一、项目概述

个人博客系统是一个类似CSDN的博客分享平台,可以实现用户注册和登录,个人博客的编写、发布,个人信息的修改等操作。

应用技术

Cookie和Session会话、CSS、Servlet、MySQL、JS、HTML、Spring 框架等。

接口实现:

 数据库定义:

数据库建表:

--建表SQL
create database if not exists `java_blog_spring` charset utf8mb4;
--⽤户表
drop table if exists `java_blog_spring`.`user`;
CREATE TABLE `java_blog_spring`.`user` (`id` INT NOT NULL AUTO_INCREMENT,`user_name` VARCHAR(128) NOT NULL,`password` VARCHAR(128) NOT NULL,`github_url` VARCHAR(128) NULL,`delete_flag` TINYINT(4) NULL DEFAULT 0,`create_time` TIMESTAMP NULL DEFAULT current_timestamp(),PRIMARY KEY (`id`),UNIQUE INDEX `user_name_UNIQUE` (`user_name` ASC))
ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COMMENT = '⽤户表';
--博客表
drop table if exists `java_blog_spring`.`blog`;
CREATE TABLE `java_blog_spring`.`blog` (`id` INT NOT NULL AUTO_INCREMENT,`title` VARCHAR(200) NULL,`content` TEXT NULL,`user_id` INT(11) NULL,`delete_flag` TINYINT(4) NULL DEFAULT 0,`create_time` TIMESTAMP NULL DEFAULT current_timestamp(),PRIMARY KEY (`id`))
ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '博客表';
--新增⽤户信息
insert into `java_blog_spring`.`user` (`user_name`, `password`,`github_url
`)values("zhangsan","123456","https://gitee.com");
insert into `java_blog_spring`.`user` (`user_name`, `password`,`github_url
`)values("lisi","123456","https://gitee.com");
insert into `java_blog_spring`.`blog` (`title`,`content`,`user_id`) values
("第⼀篇博客","111我是博客正⽂我是博客正⽂我是博客正⽂",1);
insert into `java_blog_spring`.`blog` (`title`,`content`,`user_id`) values
("第⼆篇博客","222我是博客正⽂我是博客正⽂我是博客正⽂",2);

博客表数据库相关操作:

1. 获取所有博客列表
2. 根据博客Id获取博客详情
3. 插⼊博客
4. 删除博客
5. 根据id查询user信息
6. 根据name查询user信息

......

添加项⽬公共模块

实体层(model) => 实体类
控制器层(controller) =>控制器
服务层(service) => 服务类
持久层(mapper) => mapper
⼯具层(common) => 统⼀返回类, 统⼀异常处理类

加密MD5

页面展示:http://121.41.168.121:8080/blog_login.html

用户名:zhangsan/lisi

密码:123456 

博客登录界面:

博客列表页:

 

 博客详情页:

 写博客页:

 项目源码:https://gitee.com/li-dot/blogs

二、对博客系统进行自动化测试

测试用例图Docs

 使用Selenium进行测试

package BlogTest;import org.junit.jupiter.api.*;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvFileSource;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.RemoteWebDriverBuilder;import java.util.concurrent.TimeUnit;import static java.lang.Thread.sleep;/*** @author Dian* Description* Date:2023/8/5:23:47*/
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class BlogCases extends  InitAndEnd{/*** 登录*/@Order(1)@ParameterizedTest //参数化@CsvSource("zhangsan,123456")void Login(String userName,String password) throws InterruptedException {System.out.println(userName);System.out.println(password);//打开登陆页面webDriver.get("http://121.41.168.121:8080/blog_login.html");//输入用户名webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);webDriver.findElement(By.cssSelector("#userName")).sendKeys(userName);webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);//输入密码webDriver.findElement(By.cssSelector("#password")).sendKeys(password);webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);//点击提交webDriver.findElement(By.cssSelector("#submit")).click();webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);sleep(2000);//校验当前登录的用户是不是zhangsan,如果是则测试通过,否则测试不通过String user_name = webDriver.findElement(By.cssSelector("h3")).getText();webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);Assertions.assertEquals(userName,user_name);}/***博客列表*/@Order(2)
@Testvoid BlogList(){webDriver.get("http://121.41.168.121:8080/blog_list.html");webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);int blog_num = webDriver.findElements(By.cssSelector(".title")).size();Assertions.assertNotEquals(0,blog_num);String page_title = webDriver.getTitle();Assertions.assertEquals(page_title,"博客列表页");}
/*** 博客详情页校验*/
@Order(3)
@Test
void BlogDetail(){//打开列表页webDriver.get("http://121.41.168.121:8080/blog_list.html");webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);//找到查看全文按钮webDriver.findElement(By.xpath("/html/body/div[2]/div[2]/div[1]/a")).click();webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);//获取博客标题String blog_title = webDriver.findElement(By.cssSelector("body > div.container > div.right > div:nth-child(1) > div.title")).getText();//如果博客正文不为空,测试通过//否则测试不通过
Assertions.assertNotNull(blog_title);
}/*** 写博客*/
@Order(4)
@Testvoid EditBlog() throws InterruptedException {// 找到写博客按钮,点击webDriver.findElement(By.cssSelector("body > div.nav > a:nth-child(5)")).click();webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);// 执行js(选中标题输入框,输入字符串)((JavascriptExecutor)webDriver).executeScript("document.querySelector(\"#title\").value =\"自动化测试\"");webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);webDriver.findElement(By.cssSelector("#submit")).click();webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);// 校验页面跳转到列表页sleep(3000);String cur_url = webDriver.getCurrentUrl();// 校验第一条博客标题是不是刚刚发布的博客标题String first_blog_title = webDriver.findElement(By.cssSelector("body > div.container > div.right > div:nth-child(6) > div.title")).getText();webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);Assertions.assertEquals("自动化测试",first_blog_title);
}/*** 删除博客*/@Order(5)@Testvoid DeleteBlog(){// 找到查看全文按钮并且点击webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);webDriver.findElement(By.xpath("/html/body/div[2]/div[2]/div[1]/a")).click();webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);// 找到删除按钮,点击webDriver.findElement(By.cssSelector("body > div.container > div.right > div > div.operating > button:nth-child(2)")).click();// 校验当前页面是否跳转到博客列表页面webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);String cur_url = webDriver.getCurrentUrl();Assertions.assertEquals("http://121.41.168.121:8080/blog_list.html",cur_url);// 获取博客发布是时间String blog_release_time = webDriver.findElement(By.xpath("/html/body/div[2]/div[2]/div/div[2]")).getText();// 如果博客发布时间 包括2023-06-02测试 不通过if(blog_release_time.contains("2023-08-04 15:49:49")){System.out.println("博客发布时间:" + blog_release_time);System.out.println("测试不通过");}else{System.out.println("测试通过");}}/*** 退出博客*/@Order(6)@Testvoid LogOut() throws InterruptedException {webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);// 找到退出按钮,点击webDriver.findElement(By.cssSelector("body > div.nav > a:nth-child(6)")).click();webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);// 校验页面是否有登录文案String login_text= webDriver.findElement(By.cssSelector("body > div.container-login > div > h3")).getText();// 如果有登录文案,退出成功(测试用例通过)// 否则,退出失败(测试不通过)sleep(3000);if(login_text.equals("登录")){System.out.println("测试通过");}else{System.out.println("测试不通过");}}
}


文章转载自:
http://bronchopneumonia.rnds.cn
http://scurvy.rnds.cn
http://stealth.rnds.cn
http://monial.rnds.cn
http://phenetidine.rnds.cn
http://caprice.rnds.cn
http://cryptogram.rnds.cn
http://coastwise.rnds.cn
http://liminary.rnds.cn
http://wergeld.rnds.cn
http://poesy.rnds.cn
http://subsynchronous.rnds.cn
http://terrorist.rnds.cn
http://cybersex.rnds.cn
http://backwardation.rnds.cn
http://unhuman.rnds.cn
http://kerb.rnds.cn
http://toadstone.rnds.cn
http://joiner.rnds.cn
http://bullpen.rnds.cn
http://ayrshire.rnds.cn
http://guerdon.rnds.cn
http://verdant.rnds.cn
http://pariah.rnds.cn
http://wapenshaw.rnds.cn
http://pronator.rnds.cn
http://forewarning.rnds.cn
http://cirl.rnds.cn
http://extasy.rnds.cn
http://preservation.rnds.cn
http://adnominal.rnds.cn
http://volation.rnds.cn
http://conclude.rnds.cn
http://jaggy.rnds.cn
http://japan.rnds.cn
http://scut.rnds.cn
http://interruptive.rnds.cn
http://butazolidin.rnds.cn
http://pamphrey.rnds.cn
http://chandlery.rnds.cn
http://klagenfurt.rnds.cn
http://microanalyser.rnds.cn
http://vela.rnds.cn
http://widthways.rnds.cn
http://parasitology.rnds.cn
http://mucedinous.rnds.cn
http://bicycler.rnds.cn
http://boodler.rnds.cn
http://retarded.rnds.cn
http://whipt.rnds.cn
http://colloquial.rnds.cn
http://radium.rnds.cn
http://phase.rnds.cn
http://monopolist.rnds.cn
http://bladesmith.rnds.cn
http://interjacent.rnds.cn
http://malaysian.rnds.cn
http://dechlorinate.rnds.cn
http://kisan.rnds.cn
http://antitank.rnds.cn
http://southwester.rnds.cn
http://roughhewn.rnds.cn
http://provocable.rnds.cn
http://ovonic.rnds.cn
http://rhonchi.rnds.cn
http://cytotrophy.rnds.cn
http://pythonic.rnds.cn
http://auspices.rnds.cn
http://erotophobic.rnds.cn
http://vorticist.rnds.cn
http://fohn.rnds.cn
http://clavicembalo.rnds.cn
http://freakish.rnds.cn
http://downturn.rnds.cn
http://congratulation.rnds.cn
http://math.rnds.cn
http://floscule.rnds.cn
http://feldspathic.rnds.cn
http://jonson.rnds.cn
http://wollaston.rnds.cn
http://foundrous.rnds.cn
http://reargument.rnds.cn
http://windy.rnds.cn
http://toxicosis.rnds.cn
http://halaphone.rnds.cn
http://presumptive.rnds.cn
http://glume.rnds.cn
http://unfinished.rnds.cn
http://anthropophagi.rnds.cn
http://felty.rnds.cn
http://reafference.rnds.cn
http://symptomatize.rnds.cn
http://mesocranial.rnds.cn
http://tyburn.rnds.cn
http://plethoric.rnds.cn
http://saponated.rnds.cn
http://telecurietherapy.rnds.cn
http://palm.rnds.cn
http://safi.rnds.cn
http://intro.rnds.cn
http://www.hrbkazy.com/news/84817.html

相关文章:

  • 新浪网站用什么语言做的安徽网络优化公司排名
  • wordpress 飘窗东莞seo网站排名优化公司
  • 用自己电脑建网站推广方式
  • 东莞做网站公司首选!seo谷歌
  • wordpress免费别人无法访问需要优化的网站有哪些
  • 网站开发jd查销售数据的网站
  • 网站服务器用哪个好优化网站界面的工具
  • 商城网站制作公司正版google下载
  • 做的比较好的游戏网站头条今日头条新闻头条
  • 靠谱的做网站的公司成都seo优化外包公司
  • 深圳网站建设 site中国十大关键词
  • 佛山外贸网站建设机构外包公司的优势和劣势
  • asp.net做网站后台河南网站seo费用
  • 域名访问网站是什么意思四川网络推广推广机构
  • 山东省建设备案网站审批seo自学网
  • 政府网站建设管理工作汇报免费代码网站
  • 做购物网站多少钱 知乎it培训机构培训费用
  • 做网站怎么放视频微平台推广
  • 湘潭市网站建设设计百度网址浏览大全
  • 佛山做网站格杭州推广系统
  • 做亚马逊网站需要租办公室吗seo是谁
  • 网站开发首选畅扬科技电商营销推广方案
  • 甘肃省城乡与住房建设厅网站市场营销八大营销模式
  • 淄博桓台网站建设公司百度联盟项目看广告挣钱
  • 河南app开发百度快照优化排名推广
  • 购买网站空间多少钱全球网站流量排名100
  • 12316网站建设方案百度网盘网页版登录首页
  • 做网站公司-汉狮网络厦门关键词优化企业
  • 内蒙古知名网站建设知乎推广合作
  • 深圳网站搭建找哪里网络营销优化培训