个人做电影网站/网络推广怎么做
自动化博客项目
- 用户注册
- 登录验证
- 效验个人博客列表页博客数量不为 0
- 博客系统主页
- 写博客
- 我的博客列表页
- 效验 刚发布的博客的标题和时间
- 查看 文章详情页
- 删除文章
- 效验第一篇博客 不是 "自动化测试"
- 注销
- 退出到登录页面,用户名密码为空
用户注册
@Order(1)@ParameterizedTest@CsvFileSource(resources = "regmes.csv")void Reg(String username , String password , String password2) throws InterruptedException {webDriver.get("http://211.159.172.237:8080/reg.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("#password2")).sendKeys(password2);webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);sleep(2000);//点击注册webDriver.findElement(By.cssSelector("#submit")).click();webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);sleep(2000);webDriver.switchTo().alert().accept();
登录验证
@Order(2)@ParameterizedTest@CsvFileSource(resources = "LoginSuccess.csv")void LoginSuccess(String username , String password , String blog_list_url) throws InterruptedException {//打开登录页webDriver.get("http://211.159.172.237:8080/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);sleep(3000);webDriver.findElement(By.cssSelector("#submit")).click();webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);sleep(1000);//验证urlString cur_url = webDriver.getCurrentUrl();Assertions.assertEquals(blog_list_url, cur_url);}
效验个人博客列表页博客数量不为 0
@Order(3)@Test//效验 个人博客列表页博客数量不为 0void MyBlogList() throws InterruptedException {webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);sleep(3000);int title_num = webDriver.findElements(By.cssSelector(".title")).size();Assertions.assertNotEquals(0,title_num);}
博客系统主页
写博客
@Order(4)@Testvoid AddBlog() throws InterruptedException {//到系统主页看看webDriver.findElement(By.cssSelector("body > div.nav > a:nth-child(4)")).click();webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);sleep(3000);//写博客webDriver.findElement(By.cssSelector("body > div.nav > a:nth-child(5)")).click();webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);//通过js输入((JavascriptExecutor)webDriver).executeScript("document.getElementById(\"title\").value=\"自动化测试\"");sleep(1500);//点击发布webDriver.findElement(By.cssSelector("body > div.blog-edit-container > div.title > button")).click();sleep(1500);webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);//弹窗点击取消webDriver.switchTo().alert().dismiss();String cur_url = webDriver.getCurrentUrl();Assertions.assertEquals("http://211.159.172.237:8080/myblog_list.html",cur_url);sleep(1500);// webDriver.switchTo().alert().accept();}
我的博客列表页
效验 刚发布的博客的标题和时间
@Order(5)@Test//效验已发布博客的标题和时间void BlogInfoChecked() throws InterruptedException {webDriver.get("http://211.159.172.237:8080/myblog_list.html");String first_blog_title = webDriver.findElement(By.cssSelector("#artListDiv > div:nth-child(1) > div.title")).getText();String first_blog_time = webDriver.findElement(By.xpath("//*[@id=\"artListDiv\"]/div[1]/div[2]")).getText();Assertions.assertEquals("自动化测试",first_blog_title);sleep(3000);if(first_blog_time.contains("2023-10-28")) {System.out.println("时间正确");}else {System.out.println("当前时间是 :" + first_blog_time);System.out.println("时间错误");}}
查看 文章详情页
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class BlogCases extends InitAndEnd{public static Stream<Arguments> Generator() {return Stream.of(Arguments.arguments("http://211.159.172.237:8080/blog_content.html","博客正文","自动化测试"));}@Order(6)@ParameterizedTest@MethodSource("Generator")//博客详情页void BlogContent(String expected_url , String expected_title , String expected_blog_title) throws InterruptedException {webDriver.findElement(By.xpath("//*[@id=\"artListDiv\"]/div[1]/a[1]")).click();sleep(3000);//获取当前页面的url , http://211.159.172.237:8080/blog_content.html?aid=15String cur_url = webDriver.getCurrentUrl();webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);//获取当前页面的标题 , 博客正文String cur_title = webDriver.getTitle();webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);//获取当前博客的标题 , 自动化测试String blog_title = webDriver.findElement(By.cssSelector("#title")).getText();webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);// Assertions.assertEquals(expected_url , cur_url);Assertions.assertEquals(expected_title , cur_title);Assertions.assertEquals(expected_blog_title , blog_title);if(cur_url.contains(expected_url)) {System.out.println("博客详情正确");} else {System.out.println(cur_url);System.out.println("博客详情失败");}sleep(1500);}
删除文章
效验第一篇博客 不是 “自动化测试”
@Order(7)@Test//删除刚刚发布的博客void DeleteBlog() throws InterruptedException {webDriver.get("http://211.159.172.237:8080/myblog_list.html");webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);webDriver.findElement(By.cssSelector("#artListDiv > div:nth-child(1) > a:nth-child(6)")).click();webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);sleep(3000);webDriver.switchTo().alert().accept();//效验第一篇博客不是 "自动化测试"String first_blog_title = webDriver.findElement(By.cssSelector("#artListDiv > div:nth-child(1) > div.title")).getText();webDriver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);Assertions.assertNotEquals("自动化测试",first_blog_title);sleep(3000);}
注销
@Order(8)@Test//注销void Logout() throws InterruptedException {webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
// webDriver.findElement(By.cssSelector("body > div.nav > a:nth-child(6)"));webDriver.findElement(By.xpath("/html/body/div[1]/a[3]")).click();webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);webDriver.switchTo().alert().accept();sleep(3000);String cur_url = webDriver.getCurrentUrl();Assertions.assertEquals("http://211.159.172.237:8080/login.html",cur_url);}
退出到登录页面,用户名密码为空
相关文章:

博客系统-项目测试
自动化博客项目 用户注册登录验证效验个人博客列表页博客数量不为 0 博客系统主页写博客 我的博客列表页效验 刚发布的博客的标题和时间查看 文章详情页删除文章效验第一篇博客 不是 "自动化测试" 注销退出到登录页面,用户名密码为空 用户注册 Order(1)Parameterized…...

Inspeckage,动态分析安卓 APP 的 Xposed 模块
前提 我在不久前写过《 APP 接口拦截与参数破解》的博文;最近爬取APP数据时又用到了相关技术,故在此详细描述一下 Inspeckage 的功能。(环境准备本文不再赘述) 功能 在电脑上访问 http://127.0.0.1:8008 就可以看到 inspeckage…...

Windows详细安装和彻底删除RabbitMQ图文流程
RabbiitMQ简介 RabbitMQ是实现了高级消息队列协议(AMQP:Advanced Message Queue Protocol)的开源消息代理软件(亦称面向消息的中间件)。RabbitMQ服务器是用Erlang语言编写的,而聚类和故障转移是构建在开放…...

自定义表单规则
const checkF (rule, value, callback) > { if (!value || value ) { callback(new Error(请输入XXXX)); } else { var params new URLSearchParams(); params.append(参数名, value); axios.post(url, params).then(operation > { if (operation && operatio…...

Spring 中 Bean 的作用域有哪些?Spring 中有哪些方式可以把 Bean 注入到 IOC 容器?
Spring 框架里面的 IOC 容器,可以非常方便的去帮助我们管理应用里面的Bean 对象实例。我们只需要按照 Spring 里面提供的 xml 或者注解等方式去告诉 IOC 容器,哪些 Bean需要被 IOC 容器管理就行了。 生命周期 既然是 Bean 对象实例的管理,那意…...

【01低功耗蓝牙开发】
低功耗蓝牙 低功耗蓝牙背后有个基本的概念:任何事物都有状态。状态可以是任何东西,如温度,电池状态等越简单的系统越便宜,开发更迅速,包含更少的错误,更加强健。一种技术想要获得成功必须降低成本。服务器…...

【Java 进阶篇】Java BeanUtils 使用详解
Java中的BeanUtils是一组用于操作JavaBean的工具,它允许你在不了解JavaBean的具体内部结构的情况下,访问和修改其属性。本文将详细介绍Java BeanUtils的使用,包括如何获取和设置JavaBean的属性,复制属性,以及如何处理嵌…...

YugaByteDB -- 全新的 “PostgreSQL“ 存储层
文章目录 0 背景1 架构1.1 Master1.2 TServer1.3 Tablet 2 读写链路2.1 DDL2.2 DML2.3 事务 3 KEY 的设计4 Rocksdb 在 YB 中的一些实践总结 0 背景 YugaByteDB 的诞生也是抓住了 spanner 推行的NewSQL 浪潮的尾巴,以 PG 生态为基础 用C实现的 支持 SQL 以及 CQL 语…...

众佰诚:抖音上做生意卖什么好
随着科技的发展,越来越多的人开始利用网络平台进行创业。抖音作为目前最火的短视频平台之一,也成为了许多人选择的创业渠道。那么,在抖音上做生意卖什么好呢? 首先,我们可以考虑一些具有创新性和独特性的产品。例如,手…...

【Redis】环境配置
环境配置 Linux版本: Ubuntu 22.04.2 LTS 下载redis sudo apt install redis 启动redis redis-server 输入redis-server启动redis竟然报错了,原因是redis已经启动,网上大多数的解决方案如下: ps -ef | grep -i redis 查询redi…...

设计交换机原理图前应先理清的框图
一、系统布局图 需重点考虑“外壳、电源、风扇、主板(包含MAC、CPU、PHY)、指示灯、管理网口/串口、电口/光口等连接器”在整机中的大致位置,在系统布局图中予以体现。 二、系统框图 (1)电源整体框图; &…...

Bellman-ford 贝尔曼-福特算法
Bellman-ford算法可以解决负权图的单源最短路径问题 --- 它的优点是可以解决有负权边的单源最短路径问题,而且可以判断是否负权回路 它也有明显的缺点,它的时间复杂度O(N*E)(N是点数 , E是边数)…...

Docker数据目录迁移解决方案
前置工作 使用以下命令查询当前docker数据目录安装路径: docker info | grep "Docker Root Dir"下文以 /home/rain/docker 这个路径作为要迁移的新 Docker 安装(存储)目录 迁移方案 方法一:软链接 停掉Docker服务: systemctl…...

公共字段自动填充、菜品管理
一、公共字段填充 1.1、问题分析 1.2、实现思路 1.3、代码开发 1.3.1、自定义注解 import com.sky.enumeration.OperationType;import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import jav…...

前端面试 面试多起来了
就在昨天 10.17 号,同时收到了三个同学面试的消息。他们的基本情况都是双非院校本科、没有实习经历、不会消息中间件和 Spring Cloud 微服务,做的都是单体项目。但他们投递简历还算积极,从今年 9 月初就开始投递简历了,到现在也有一个多月了。 来看看,这些消息。 为…...

Qt常见类名关系整理
1、QAbstractItemModel与QAbstractItemView 模型的基类: The QAbstractItemModel class provides the abstract interface for item model classes. Inherited By: QAbstractListModel,QAbstractProxyModel,and QAbstractTableModel 视图的基类: The QAbstractIte…...

YOLO8实战:yolov8实现行人跟踪计数
本篇文章首先介绍YOLOV8实现人流量跟踪计数的原理,文末附代码 引言:行人跟踪统计是智能监控系统中的重要功能,可以广泛应用于人流控制、安全监控等领域。传统的行人跟踪算法往往受到光照、遮挡等因素的干扰,难以实现准确跟踪。随着深度学习技术的发展,目标检测模型逐渐成为…...

shell脚本学习-2
文章目录 一、shell参数传递二、shell中的特殊变量三、shell中的函数四、shell函数中的参数 一、shell参数传递 运行 Shell 脚本文件时我们可以给它传递一些参数,这些参数在脚本文件内部可以使用$n的形式来接收,例如,$1 表示第一个参数&…...

web3:智能合约浏览器版本的 IDE - remix 使用教程
如果你是一位web3行业的从业者,那么智能合约一定是要接触的,这里我们就智能合约浏览器版本的 IDE-remix来介绍一下,及简单的使用操作 目录 Remix简介官方网址语言设置使用编辑合约编译合约部署合约测试验证Remix简介 Remix 是一个开源的 Solidity 智能合约开发环境,是一款…...

信号类型(通信)——QPSK、OQPSK、IJF_OQPSK调制信号
系列文章目录 《信号类型(通信)——仿真》 《信号类型(通信)——QAM调制信号》 文章目录 前言 一、QPSK通信调制信号 1.1、原理 1.2、仿真 二、OQPSK通信调制信号 1.1、原理 1.2、仿真 三、IJF_OQPSK通信调制信号 1.1、…...

常用压缩文件操作函数总结
常用压缩文件操作函数总结 1- 解压gz文件 gzip -d xx.gz 2- 函数 1 打开文件 函数名: gzopen 功能描述: 打开名为file的gz文件 参数: file:文件名 mode:打开模式 r 返回值: 打开的gz文件描述符 gzFile gzopen(const char *file, const char…...

leetcode_274 H指数
1. 题意 在数组中找到最大的k, 使得至少k个数不小于k。 H指数 2. 题解 2.1 排序 从大到小排序完后,直接模拟即可。 class Solution { public:int hIndex(vector<int>& citations) {sort( citations.begin(), citations.end() );int res 0;int cur …...

微服务框架Consul--新手入门
Consul Consul 是由 HashiCorp 开发的一款软件工具,提供了一组功能,用于服务发现、配置管理和网络基础设施自动化。它旨在帮助组织管理现代分布式和微服务架构系统的复杂性。以下是Consul的一些关键方面和功能: 服务发现:Consul …...

docker运行syslog-ng,搭建日志服务器
Splunk 的数据很多是用syslog-ng 来收集的。 使用docker 来搭建syslog-ng 服务器还是很方便的。 #create network docker network create -d macvlan --subnet=192.7.0.0/16 --gateway=192.7.0.1 -o parent=ens35 docker-out docker network create -d macvlan --ipv6 --sub…...

Redis代替session实现用户验证
一、Redis代替session实现用户验证。 下图是session的实现登录需要实现的代码模块,虽然可以实现完整功能,但是仍然存在一些问题。 在以往使用session当作用户验证的过程中,会有session共享的问题,每次承担请求的tomcat是不一样…...

Ubuntu 内核降级到指定版本
reference https://www.cnblogs.com/leebri/p/16786685.html 前往此网站,找到所需的内核 https://kernel.ubuntu.com/~kernel-ppa/mainline/ 查看系统架构 dpkg --print-architecture 二、下载安装包 注意:下载除lowlatency以外的deb包 三、安装内核 3…...

uniapp开发app,在ios真机上出现的css样式问题
比如下面的问题,在iphone 13上出现,在iphone xR上正常。 问题一:border:1rpx造成边框显示不全 在iphone13上border边框有一部分不显示: 在iphone xR上显示正常: 解决办法是: 将border边框设置中的1rpx改…...

uniapp 页面间传参方法
页面之间传参大概可分为以下几种情况: 上级页面 → 下级页面(单向)上级页面 ← 下级页面(单向)上级页面 ↔ 下级页面(双向) 一、上级页面 → 下级页面(单向) uni.naviga…...

【年终特惠】基于最新导则下生态环评报告编制技术暨报告篇、制图篇、指数篇、综合应用篇系统性实践技能提升
根据生态环评内容庞杂、综合性强的特点,依据生态环评最新导则,将内容分为4大篇章(报告篇、制图篇、指数篇、综合篇)、10大专题(生态环评报告编制、土地利用图的制作、植被类型及植被覆盖度图的制作、物种适宜生境分布图的制作、生物多样性测定、生物量及…...

驱动开发7 基于GPIO子系统编写LED驱动,编写应用程序进行测试设置定时器,5秒钟打印一次hello world
驱动代码 #include <linux/init.h> #include <linux/module.h> #include <linux/of.h> #include <linux/of_gpio.h> #include <linux/gpio.h> #include <linux/timer.h> #include <linux/of_irq.h> #include <linux/interrupt.h…...