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

问卷系统测试报告

目录

一、项目介绍

二、测试计划

2.1 用例编写

2.2 演示部分测试用例(功能测试)

2.2.1 正常登录

2.2.2 异常登录

2.2.3 注册

2.2.4 首页-创建问卷

2.2.5 我的项目

2.2.6 我的练习

2.2.7 模板广场

2.2.8 系统管理

三、自动化测试

3.1 公共类

3.2 登录功能校验

3.3 注册功能校验

3.4 首页功能校验

3.5 我的项目页面功能校验

3.6 我的练习页面功能校验

3.7 我的题库页面功能校验

3.8 问题管理界面功能校验

3.9 我的笔记页面功能校验

3.10 模板广场页面功能校验

3.11 用户管理页面功能校验

3.12 个人设置页面功能校验

自动化测试全过程:

四、测试问题

4.1 bug01

4.2 bug02

4.3 bug03

4.4 bug04

4.5 bug05

五、测试总结


一、项目介绍

“问卷考试系统” 是一款聚焦教育与调研场景,集问卷创建、考试组织、练习管理、数据统计分析于一体的数字化工具平台,为个人及组织提供便捷、高效的线上交互与评估解决方案 。

项目核心功能主要包括以下几个模块:

  • 用户模块:实现登录、注册、个人信息的维护与修改
  • 首页:可以创建问卷,创建考试,查看问卷记录和考试记录
  • 我的项目:可以查看在首页创建的问卷和考试;在该页面也可以创建,创建方式新增Excel导入、文本导入、模板导入等;可以对项目进行编辑、下载、删除等操作
  • 我的练习:可以查看练习,并对练习进行:查看结果、二维码、删除等操作
  • 我的题库:展示题库,可以对题库进行文本导入、模板导入、试题管理、编辑、删除、新建、导出等操作
  • 问题管理:可以对题库中的试题进行编辑等操作
  • 模板广场:支持问卷/考试模板的创建、新增、导入等操作

二、测试计划

2.1 用例编写

2.2 演示部分测试用例(功能测试)

2.2.1 正常登录

点击登录,进入首页:

2.2.2 异常登录

用户名为空

密码为空

用户名或密码错误

2.2.3 注册

点击注册账户,跳转至登录界面:

再进行登录

2.2.4 首页-创建问卷

点击创建问卷

编辑问卷并保存

可以在我的项目中查看:

2.2.5 我的项目

新建,以在线考试为例

编辑内容后保存

回到我的项目页面

点击"打开",进入考试

2.2.6 我的练习

查询


查看结果

2.2.7 题库中心

我的题库 

删除

问题管理

批量编辑

我的笔记

查询

2.2.7 模板广场

添加模板

点击保存

2.2.8 系统管理

用户管理

删除用户

二次弹窗确认删除后

批量导入

上传文件后,点击导入

个人设置

基本设置,填好字段后,点击提交

安全设置

重新登录一下

三、自动化测试

接下来会通过selenium完成该项目的自动化测试,以模拟真实用户的操作

3.1 公共类

由于每个界面都需要驱动、截图、登录,部分页面对某些元素进行操作时,需要将当前页面先滑动至目标元素处才能进行操作,所以将以上功能写进一个公共类Utils中

package common;import io.github.bonigarcia.wdm.WebDriverManager;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;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));}public static void login() {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待driver.findElement(By.cssSelector("#username")).clear();driver.findElement(By.cssSelector("#password")).clear();driver.findElement(By.cssSelector("#username")).sendKeys("sans");driver.findElement(By.cssSelector("#password")).sendKeys("123123");driver.findElement(By.cssSelector("#root > div > div.content___2zk1- > div.main___x4OjT > div > form > button > span")).click();//检查点击登陆之后是否登陆成功wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-heading > div > span")));driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-heading > div > span"));//页面url来检查是否登陆成功String expect = driver.getCurrentUrl();System.out.println("当前页面url为: "+ expect);assert expect.equals("http://8.155.1.153:8081/home");}
}

3.2 登录功能校验

package tests;import common.Utils;
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.155.1.153:8081/user/login";public LoginPage() {super(url);}/*** 检查页面是否正常显示*/public void  loginPageRight() throws InterruptedException, IOException {//通过查看页面元素是否存在来检查页面加载成功与否driver.findElement(By.cssSelector("#root > div > div.content___2zk1- > div.main___x4OjT > div > form > button > span"));//用户名输入框driver.findElement(By.cssSelector("#username"));}/*** 检查登录功能---成功登录*/public void LoginSuc() throws IOException, InterruptedException {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待driver.findElement(By.cssSelector("#username")).clear();driver.findElement(By.cssSelector("#password")).clear();driver.findElement(By.cssSelector("#username")).sendKeys("sans");driver.findElement(By.cssSelector("#password")).sendKeys("123456");driver.findElement(By.cssSelector("#root > div > div.content___2zk1- > div.main___x4OjT > div > form > button > span")).click();//检查点击登陆之后是否登陆成功wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-heading > div > span")));driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-heading > div > span"));//页面url来检查是否登陆成功String expect = driver.getCurrentUrl();System.out.println("当前页面url为: "+ expect);assert expect.equals("http://8.155.1.153:8081/home");//截图getScreenShot(getClass().getName());// 回到登录界面driver.navigate().back();}/*** 检查登录功能---登录失败*/public void LoginFail() throws IOException {driver.navigate().refresh();//账号存在, 密码错误driver.findElement(By.cssSelector("#username")).sendKeys("sans");driver.findElement(By.cssSelector("#password")).sendKeys("123"); //正确密码为:123123driver.findElement(By.cssSelector("#root > div > div.content___2zk1- > div.main___x4OjT > div > form > button > span")).click();driver.navigate().refresh();//用户名不存在, 密码非空driver.findElement(By.cssSelector("#username")).sendKeys("aaa");driver.findElement(By.cssSelector("#password")).sendKeys("123456");driver.findElement(By.cssSelector("#root > div > div.content___2zk1- > div.main___x4OjT > div > form > button > span")).click();String curUrl = driver.getCurrentUrl();getScreenShot(getClass().getName());//如果点击登录后, 当前仍在登录界面, 则登录失败assert curUrl.equals("http://8.155.1.153:8081/user/login");System.out.println("登录失败");}
}

3.3 注册功能校验

package tests;import common.Utils;
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 RegisterPage extends Utils {public static String url = "http://8.155.1.153:8081/user/register";public RegisterPage() {super(url);}/*** 注册界面是否正常显示*/public void RegisterPageRight() {//密码确认driver.findElement(By.cssSelector("#rePassword"));//重新登录driver.findElement(By.cssSelector("#root > div > div.content___1k5Ro > div.main___19HXK > div > form > div:nth-child(6) > a"));}/*** 注册失败, 以密码和确认密码不一致 & 用户名已存在 作为测试用例*/public void RegisterFail() throws InterruptedException {driver.navigate().refresh();//用户名已存在driver.findElement(By.cssSelector("#name")).sendKeys("sans");driver.findElement(By.cssSelector("#username")).sendKeys("sans");driver.findElement(By.cssSelector("#password")).sendKeys("123456");driver.findElement(By.cssSelector("#rePassword")).sendKeys("123456");driver.findElement(By.cssSelector("#root > div > div.content___1k5Ro > div.main___19HXK > div > form > button")).click();String str = driver.findElement(By.cssSelector("#root > div > div.content___1k5Ro > div.main___19HXK > div > form > div.ant-alert.ant-alert-error > div > div")).getText();assert "账号已存在".equals(str);//刷新页面清空输入框driver.navigate().refresh();//密码和确认密码不一致driver.findElement(By.cssSelector("#name")).sendKeys("passwordTest");driver.findElement(By.cssSelector("#username")).sendKeys("passwordTest");driver.findElement(By.cssSelector("#password")).sendKeys("123456");driver.findElement(By.cssSelector("#rePassword")).sendKeys("123");driver.findElement(By.cssSelector("#root > div > div.content___1k5Ro > div.main___19HXK > div > form > button")).click();String ele = driver.findElement(By.cssSelector("#rePassword_help > div")).getText();assert "两次密码不一致!".equals(ele);}/*** 注册成功*/public void RegisterSuc() throws IOException, InterruptedException {//刷新页面, 清空输入框driver.navigate().refresh();driver.findElement(By.cssSelector("#name")).sendKeys("auto02");driver.findElement(By.cssSelector("#username")).sendKeys("auto02");driver.findElement(By.cssSelector("#password")).sendKeys("123456");driver.findElement(By.cssSelector("#rePassword")).sendKeys("123456");driver.findElement(By.cssSelector("#root > div > div.content___1k5Ro > div.main___19HXK > div > form > button")).click();//点击注册后进入登录界面//截图WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#root > div > div.content___2zk1- > div.main___x4OjT > div > form > div:nth-child(4) > a")));getScreenShot(getClass().getName());//获取当前页面urlString ele = driver.getCurrentUrl();//如果已经跳转至登录界面, 则注册成功assert ele.equals("http://8.155.1.153:8081/user/login");}}

3.4 首页功能校验

package tests;import common.Utils;
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 HomePage extends Utils {public static String url = "http://8.155.1.153:8081/home";public HomePage() {super(url);}/*** 未登录状态下, 进入首页*/public void HomePageFail() throws IOException {//直接跳转至用户登录界面String curUrl = driver.getCurrentUrl();assert curUrl.equals("http://8.155.1.153:8081/user/login");System.out.println("homePageFail");}/*** 登录后, 可以正常进入首页*/public void HomePageSuc() throws IOException, InterruptedException {//Utils.login();WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-heading > div > span")));//检查创建问卷按钮是否存在driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-sm-24.ant-col-md-24.ant-col-lg-24.ant-col-xl-8 > div > div.ant-card-body > div > a:nth-child(1)"));//检查头像driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-content > div > div > div > div > div > div.avatar___3ZBop > span > img"));//截图getScreenShot(getClass().getName());}/*** 首页-创建问卷*/public void createQuestionnaire() throws IOException, InterruptedException {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待//点击创建问卷driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-sm-24.ant-col-md-24.ant-col-lg-24.ant-col-xl-8 > div > div.ant-card-body > div > a:nth-child(1)")).click();System.out.println("点击创建问卷");Thread.sleep(3000);//点击保存driver.findElement(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button.ant-btn.ant-btn-primary.ant-btn-sm > span")).click();System.out.println("点击保存");driver.navigate().to("http://8.155.1.153:8081/home");wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-heading > div > span")));//点击我的项目driver.findElement(By.cssSelector("#sk-layout > div > div > section > aside > div > div:nth-child(1) > ul > li:nth-child(2) > span > a")).click();getScreenShot(getClass().getName());}/*** 首页-创建考试*/public void createExam() throws InterruptedException, IOException {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待driver.manage().window().maximize();//回到首页driver.navigate().to("http://8.155.1.153:8081/home");driver.findElement(By.cssSelector("#sk-layout > div > div > section > aside > div > div:nth-child(1) > ul > li.ant-menu-item.ant-menu-item-selected.ant-menu-item-only-child.ant-pro-base-menu-menu-item > span > div > span.ant-pro-base-menu-item-text.ant-pro-base-menu-item-text-has-icon")).click();System.out.println("回到首页");//点击创建考试driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-sm-24.ant-col-md-24.ant-col-lg-24.ant-col-xl-8 > div > div.ant-card-body > div > a:nth-child(2)")).click();System.out.println("点击创建考试");driver.manage().window().maximize();wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button.ant-btn.ant-btn-primary.ant-btn-sm > span")));//点击保存driver.findElement(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button.ant-btn.ant-btn-primary.ant-btn-sm > span")).click();System.out.println("点击保存");driver.navigate().to("http://8.155.1.153:8081/home");wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-heading > div > span")));//点击我的项目driver.findElement(By.cssSelector("#sk-layout > div > div > section > aside > div > div:nth-child(1) > ul > li:nth-child(2) > span > a")).click();getScreenShot(getClass().getName());}}

3.5 我的项目页面功能校验

package tests;import common.Utils;
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 ProjectPage extends Utils {public static String url = "http://8.155.1.153:8081/project";public ProjectPage() {super(url);}/*** 我的项目页面显示*/public void ProjectPageRight() throws InterruptedException {//Utils.login();driver.navigate().to("http://8.155.1.153:8081/project");//我的项目driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-heading > div > span"));//新建按钮driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-heading > span > div > div > button"));}public void projectQuery() throws IOException {//查询名为 "搜索测试" 的项目driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-content > div > div > div > div > div > div > div > span > span > input")).sendKeys("搜索测试");//点击搜索按钮driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-content > div > div > div > div > div > div > div > span > span > span > button")).click();String text = driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-list.ant-list-split.ant-list-grid.survey-home-content > div > div > div > div > div > div > div > div > div > div.card-header > span.survey-title")).getText();assert "搜索测试".equals(text);getScreenShot(getClass().getName());}public void projectAdd() throws IOException, InterruptedException {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待/*在线考试*///点击新建按钮driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-heading > span > div > div > button")).click();//点击在线考试driver.findElement(By.cssSelector("body > div:nth-child(7) > div > div > ul > li:nth-child(2) > span")).click();//窗口最大化, 让保存按钮出现driver.manage().window().maximize();//点击保存wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button.ant-btn.ant-btn-primary.ant-btn-sm")));driver.findElement(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button.ant-btn.ant-btn-primary.ant-btn-sm")).click();//回到我的项目页面driver.navigate().to("http://8.155.1.153:8081/project");getScreenShot(getClass().getName());}}

3.6 我的练习页面功能校验

package tests;import common.Utils;
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 ExercisePage extends Utils {public static String url = "http://8.155.1.153:8081/exercise";public ExercisePage() {super(url);}public void exerciseOption() throws IOException, InterruptedException {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待//Utils.login();//跳转至我的练习页面driver.findElement(By.cssSelector("#sk-layout > div > div > section > aside > div > div:nth-child(1) > ul > li.ant-menu-item.ant-menu-item-selected.ant-menu-item-only-child.ant-pro-base-menu-menu-item > span > div > span.ant-pro-base-menu-item-text.ant-pro-base-menu-item-text-has-icon")).click();//查看结果driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div.ant-pro-table > div:nth-child(2) > div > div.ant-table-wrapper > div > div > div > div > div > table > tbody > tr:nth-child(1) > td:nth-child(6) > div > div:nth-child(1) > a")).click();getScreenShot(getClass().getName());driver.navigate().back();System.out.println("查看结果完成");//二维码driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div.ant-pro-table > div:nth-child(2) > div > div.ant-table-wrapper > div > div > div > div > div > table > tbody > tr:nth-child(1) > td:nth-child(6) > div > div:nth-child(2) > a")).click();getScreenShot(getClass().getName());System.out.println("二维码完成");//继续答题driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div.ant-pro-table > div:nth-child(2) > div > div.ant-table-wrapper > div > div > div > div > div > table > tbody > tr:nth-child(2) > td:nth-child(6) > div > div:nth-child(1) > a")).click();getScreenShot(getClass().getName());driver.navigate().back();System.out.println("继续答题完成");//开始练习driver.findElement(By.cssSelector("#rc-tabs-2-tab-undefined > span")).click();driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div.ant-pro-table > div:nth-child(2) > div > div.ant-table-wrapper > div > div > div > div > div > table > tbody > tr:nth-child(1) > td:nth-child(3) > div > div > a")).click();wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("body > div:nth-child(7) > div > div.ant-modal-wrap > div > div.ant-modal-content > div > div > div.ant-card-body > div:nth-child(1) > div")));driver.findElement(By.cssSelector("body > div:nth-child(7) > div > div.ant-modal-wrap > div > div.ant-modal-content > div > div > div.ant-card-body > div:nth-child(1) > div")).click();driver.navigate().back();getScreenShot(getClass().getName());System.out.println("开始练习完成");}}

3.7 我的题库页面功能校验

package tests;import common.Utils;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;import java.io.IOException;
import java.time.Duration;public class StorePage extends Utils {public static String url = "http://8.155.1.153:8081/repo/index";public StorePage() {super(url);}public void storePageRight() throws InterruptedException {//Utils.login();driver.manage().window().maximize();//跳转至我的题库页面//点击题库中心driver.findElement(By.cssSelector("#sk-layout > div > div > section > aside > div > div:nth-child(1) > ul > li:nth-child(4) > div > span > div > span.ant-pro-base-menu-item-text.ant-pro-base-menu-item-text-has-icon")).click();//点击我的题库driver.navigate().to("http://8.155.1.153:8081/repo/index");//新建按钮driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div > div.ant-pro-table-list-toolbar > div > div.ant-space.ant-space-horizontal.ant-space-align-center.ant-pro-table-list-toolbar-right > div:nth-child(1) > div > div:nth-child(1) > button"));//导出按钮driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div > div.ant-pro-table-list-toolbar > div > div.ant-space.ant-space-horizontal.ant-space-align-center.ant-pro-table-list-toolbar-right > div:nth-child(1) > div > div:nth-child(2) > button"));}
//driver.findElement(By.cssSelector());public void storeQuery() throws IOException, InterruptedException {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待//输入名称driver.findElement(By.cssSelector("#name")).sendKeys("高等数学");//Thread.sleep(500);//点击查询wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(3) > div > div > div.ant-col.ant-form-item-control > div > div > div > div > div > div:nth-child(2) > button > span")));driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(3) > div > div > div.ant-col.ant-form-item-control > div > div > div > div > div > div:nth-child(2) > button > span")).click();//点击重置driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(3) > div > div > div.ant-col.ant-form-item-control > div > div > div > div:nth-child(1) > div > div:nth-child(1) > button > span")).click();//选择类型driver.findElement(By.cssSelector("#mode")).click();driver.findElement(By.cssSelector("#mode")).sendKeys(Keys.ENTER);//Thread.sleep(500);//点击查询wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(3) > div > div > div.ant-col.ant-form-item-control > div > div > div > div > div > div:nth-child(2) > button > span")));driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(3) > div > div > div.ant-col.ant-form-item-control > div > div > div > div > div > div:nth-child(2) > button > span")).click();//点击重置driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(3) > div > div > div.ant-col.ant-form-item-control > div > div > div > div:nth-child(1) > div > div:nth-child(1) > button > span")).click();getScreenShot(getClass().getName());}public void storeAdd() throws InterruptedException {//点击新建driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div > div.ant-pro-table-list-toolbar > div > div.ant-space.ant-space-horizontal.ant-space-align-center.ant-pro-table-list-toolbar-right > div:nth-child(1) > div > div:nth-child(1) > button > span:nth-child(2)")).click();Thread.sleep(3000);//题库名称driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-body > form > div:nth-child(2) > div > div:nth-child(1) > div > div > div.ant-col.ant-form-item-control > div > div > span > input")).sendKeys("测试题库");//题库类型driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-body > form > div:nth-child(2) > div > div:nth-child(4) > div > div > div.ant-col.ant-form-item-control > div > div > div > div > span.ant-select-selection-search > input")).click();driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-body > form > div:nth-child(2) > div > div:nth-child(4) > div > div > div.ant-col.ant-form-item-control > div > div > div > div > span.ant-select-selection-search > input")).sendKeys(Keys.ENTER);//点击确定driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-footer > div > div > div:nth-child(2) > button > span")).click();System.out.println("新建完成");}public void storeOption() throws IOException, InterruptedException {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待//文本导入driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div > div.ant-table-wrapper > div > div > div > div > div > table > tbody > tr:nth-child(2) > td:nth-child(9) > div > div:nth-child(1) > a")).click();wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("body > div:nth-child(8) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-header > div.ant-drawer-extra > div > div:nth-child(2) > button > span")));//点击添加driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-header > div.ant-drawer-extra > div > div:nth-child(2) > button > span")).click();//试题管理driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div > div.ant-table-wrapper > div > div > div > div > div > table > tbody > tr:nth-child(3) > td:nth-child(9) > div > div:nth-child(3) > a")).click();//添加试题driver.findElement(By.cssSelector("body > div:nth-child(9) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-body > div > div:nth-child(2) > div > div.ant-pro-table-list-toolbar > div > div.ant-space.ant-space-horizontal.ant-space-align-center.ant-pro-table-list-toolbar-right > div:nth-child(1) > div > div > button > span:nth-child(2)")).click();getScreenShot(getClass().getName());//关闭Thread.sleep(2000);//wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button.ant-btn.ant-btn-primary.ant-btn-sm.ant-btn-dangerous > span")));driver.findElement(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button.ant-btn.ant-btn-primary.ant-btn-sm.ant-btn-dangerous > span")).click();//点击编辑driver.findElement(By.cssSelector("body > div:nth-child(9) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-body > div > div:nth-child(2) > div > div.ant-table-wrapper > div > div > div > div > div > table > tbody > tr:nth-child(2) > td.ant-table-cell.ant-table-cell-fix-right.ant-table-cell-fix-right-first > div > div > a")).click();//点击保存Thread.sleep(2000);//wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button:nth-child(5) > span")));driver.findElement(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button:nth-child(5) > span")).click();}}

3.8 问题管理界面功能校验

package tests;import common.Utils;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;import java.io.IOException;
import java.time.Duration;public class QuestionManagePage extends Utils {public static String url = "http://8.155.1.153:8081/repo/template";public QuestionManagePage() {super(url);}public void questionPageRight() {//Utils.login();driver.manage().window().maximize();//跳转至问题管理//点击题库中心driver.findElement(By.cssSelector("#sk-layout > div > div > section > aside > div > div:nth-child(1) > ul > li:nth-child(4) > div > span > div > span.ant-pro-base-menu-item-text.ant-pro-base-menu-item-text-has-icon")).click();//点击我的题库driver.navigate().to("http://8.155.1.153:8081/repo/template");//试题列表driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div > div.ant-pro-table-list-toolbar > div > div.ant-pro-table-list-toolbar-left > div"));}public void questionQuery() throws InterruptedException {//展开//driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(5) > div > div > div.ant-col.ant-form-item-control > div > div > div > div:nth-child(2) > a")).click();//类型driver.findElement(By.cssSelector("#mode")).click();driver.findElement(By.cssSelector("#mode")).sendKeys(Keys.ENTER);//点击查询Thread.sleep(500);driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(5) > div > div > div.ant-col.ant-form-item-control > div > div > div > div:nth-child(1) > div > div:nth-child(2) > button > span")).click();//点击重置driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(5) > div > div > div.ant-col.ant-form-item-control > div > div > div > div:nth-child(1) > div > div:nth-child(1) > button > span")).click();//题型driver.findElement(By.cssSelector("#questionType")).click();driver.findElement(By.cssSelector("#questionType")).sendKeys(Keys.ENTER);//点击查询Thread.sleep(500);driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(5) > div > div > div.ant-col.ant-form-item-control > div > div > div > div:nth-child(1) > div > div:nth-child(2) > button > span")).click();//点击重置driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(5) > div > div > div.ant-col.ant-form-item-control > div > div > div > div:nth-child(1) > div > div:nth-child(1) > button > span")).click();}public void questionEdit() throws IOException, InterruptedException {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待//编辑driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div > div.ant-table-wrapper > div > div > div > div > div > table > tbody > tr:nth-child(2) > td.ant-table-cell.ant-table-cell-fix-right.ant-table-cell-fix-right-first > div > div > a")).click();wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button:nth-child(5) > span")));Thread.sleep(2000);driver.findElement(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button:nth-child(5) > span")).click();getScreenShot(getClass().getName());//批量编辑driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div > div.ant-table-wrapper > div > div > div > div > div > table > tbody > tr:nth-child(2) > td.ant-table-cell.ant-table-selection-column > label > span > input")).click();driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div > div.ant-pro-table-alert > div > div > div > div > div.ant-pro-table-alert-info-option > div > div:nth-child(2) > a")).click();Thread.sleep(2000);driver.findElement(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button:nth-child(5) > span")).click();}}

3.9 我的笔记页面功能校验

package tests;import common.Utils;
import org.openqa.selenium.By;import java.io.IOException;public class BookPage extends Utils {public static String url = "http://8.155.1.153:8081/repo/book";public BookPage() {super(url);}public void bookPageRight() throws IOException {//Utils.login();//跳转至我的笔记页面driver.navigate().to("http://8.155.1.153:8081/repo/book");//我的笔记driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-has-footer.ant-page-header-ghost > div.ant-page-header-heading > div > span"));//我的错题driver.findElement(By.cssSelector("#rc-tabs-0-tab-wrong"));getScreenShot(getClass().getName());}public void bookQuery() {//问题标题driver.findElement(By.cssSelector("#name")).sendKeys("单选题");//点击查询driver.findElement(By.cssSelector("#sk-layout > div > div > section > div > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-card-border.ant-pro-card-bordered.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(4) > div > div > div.ant-col.ant-form-item-control > div > div > div > div:nth-child(1) > div > div:nth-child(2) > button > span")).click();//点击重置driver.findElement(By.cssSelector("#sk-layout > div > div > section > div > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-card-border.ant-pro-card-bordered.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(4) > div > div > div.ant-col.ant-form-item-control > div > div > div > div:nth-child(1) > div > div:nth-child(1) > button > span")).click();driver.manage().window().maximize();//创建时间driver.findElement(By.cssSelector("#createAt")).sendKeys("2025-08-10");//结束时间driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-card-border.ant-pro-card-bordered.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(3) > div > div > div.ant-col.ant-form-item-control > div > div > div > div.ant-picker-input.ant-picker-input-active > input")).sendKeys("2025-08-12");//点击查询driver.findElement(By.cssSelector("#sk-layout > div > div > section > div > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-card-border.ant-pro-card-bordered.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(4) > div > div > div.ant-col.ant-form-item-control > div > div > div > div:nth-child(1) > div > div:nth-child(2) > button > span")).click();//点击重置driver.findElement(By.cssSelector("#sk-layout > div > div > section > div > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-card-border.ant-pro-card-bordered.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(4) > div > div > div.ant-col.ant-form-item-control > div > div > div > div:nth-child(1) > div > div:nth-child(1) > button > span")).click();}
}

3.10 模板广场页面功能校验

package tests;import common.Utils;
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 TemplatePage extends Utils {public static String url = "http://8.155.1.153:8081/repo/book";public TemplatePage() {super(url);}public void TemplatePageRight() throws InterruptedException {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待//Utils.login();driver.manage().window().maximize();//跳转至模板广场driver.findElement(By.cssSelector("#sk-layout > div > div > section > aside > div > div:nth-child(1) > ul > li:nth-child(5) > span > a")).click();//模板广场wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-has-footer.ant-page-header-ghost > div.ant-page-header-heading > div > span")));driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-has-footer.ant-page-header-ghost > div.ant-page-header-heading > div > span"));}public void TemplateQuery() throws IOException {//点击 "二号"driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-card > div > form > div:nth-child(1) > div.content___1TohL > div > div > div > div > div > div > span:nth-child(2)")).click();getScreenShot(getClass().getName());//取消二号driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-card > div > form > div:nth-child(1) > div.content___1TohL > div > div > div > div > div > div > span:nth-child(2)")).click();//点击 "全部"driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-card > div > form > div:nth-child(1) > div.content___1TohL > div > div > div > div > div > div > span:nth-child(1)")).click();getScreenShot(getClass().getName());//System.out.println("已点完全部");//搜索框输入测试driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-has-footer.ant-page-header-ghost > div.ant-page-header-content > div > div > div > div > div > span > span > input")).sendKeys("测试");//点击搜模板driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-has-footer.ant-page-header-ghost > div.ant-page-header-content > div > div > div > div > div > span > span > span > button > span")).click();getScreenShot(getClass().getName());}public void TemplateAdd() throws InterruptedException, IOException {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待//点击 添加模板driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-has-footer.ant-page-header-ghost > div.ant-page-header-heading > span > div > div > button > span")).click();//点击 保存wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button:nth-child(5) > span")));driver.findElement(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button:nth-child(5) > span")).click();//输入模板信息driver.findElement(By.cssSelector("#name")).sendKeys("自动模板");driver.findElement(By.cssSelector("#category")).sendKeys("自动类别");//点保存driver.findElement(By.cssSelector("#survey-modal-container > div > div > div.ant-modal-wrap > div > div.ant-modal-content > div.ant-modal-footer > button.ant-btn.ant-btn-primary > span")).click();Thread.sleep(1000);//点关闭driver.findElement(By.cssSelector("#editor > div.survey-main-panel > div.survey-main-panel-toolbar > div:nth-child(2) > div > button.ant-btn.ant-btn-primary.ant-btn-sm.ant-btn-dangerous > span")).click();//点私有库driver.findElement(By.cssSelector("#rc-tabs-1-tab-private")).click();getScreenShot(getClass().getName());}}

3.11 用户管理页面功能校验

package tests;import common.Utils;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;import java.time.Duration;public class UserPage extends Utils {public static String url = "http://8.155.1.153:8081/system/user";public UserPage() {super(url);}public void UserPageRight() {//Utils.login();driver.manage().window().maximize();//跳转至用户管理driver.findElement(By.cssSelector("#sk-layout > div > div > section > aside > div > div:nth-child(1) > ul > li:nth-child(6) > div > span > div > span.ant-pro-base-menu-item-text.ant-pro-base-menu-item-text-has-icon")).click();driver.navigate().to("http://8.155.1.153:8081/system/user");//系统用户列表driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-md-18 > div > div:nth-child(2) > div > div.ant-pro-table-list-toolbar > div > div.ant-pro-table-list-toolbar-left > div"));}public void UserQuery() {WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); //显示等待driver.findElement(By.cssSelector("#name")).sendKeys("test01");//点击查询wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-md-18 > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div.ant-col.ant-col-8.ant-col-offset-8 > div > div > div.ant-col.ant-form-item-control > div > div > div > div > div > div:nth-child(2) > button > span")));driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-md-18 > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div.ant-col.ant-col-8.ant-col-offset-8 > div > div > div.ant-col.ant-form-item-control > div > div > div > div > div > div:nth-child(2) > button > span")).click();//点击重置driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-md-18 > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div.ant-col.ant-col-8.ant-col-offset-8 > div > div > div.ant-col.ant-form-item-control > div > div > div > div > div > div:nth-child(1) > button > span")).click();}public void UserAdd() {driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-md-18 > div > div:nth-child(2) > div > div.ant-pro-table-list-toolbar > div > div.ant-space.ant-space-horizontal.ant-space-align-center.ant-pro-table-list-toolbar-right > div:nth-child(1) > div > div:nth-child(1) > button")).click();//用户名driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-body > form > div:nth-child(2) > div > div:nth-child(1) > div > div > div.ant-col.ant-form-item-control > div > div > span > input")).sendKeys("add02");//登录名driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-body > form > div:nth-child(2) > div > div:nth-child(2) > div > div > div.ant-col.ant-form-item-control > div > div > span > input")).sendKeys("add02");//输入密码driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-body > form > div:nth-child(3) > div > div:nth-child(1) > div > div > div.ant-col.ant-form-item-control > div > div > span > input")).sendKeys("123456");//确认密码driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-body > form > div:nth-child(3) > div > div:nth-child(2) > div > div > div.ant-col.ant-form-item-control > div > div > span > input")).sendKeys("123456");//状态driver.findElement(By.cssSelector("#status")).click();driver.findElement(By.cssSelector("#status")).sendKeys(Keys.ENTER);//点击确定driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-drawer-content-wrapper > div > div > div.ant-drawer-footer > div > div > div:nth-child(2) > button > span")).click();}
}

3.12 个人设置页面功能校验

package tests;import common.Utils;
import org.openqa.selenium.By;public class PersonalPage extends Utils {public static String url = "http://8.155.1.153:8081/system/setting";public PersonalPage() {super(url);}public void personalPageRight() {//Utils.login();//跳转至个人设置driver.navigate().to("http://8.155.1.153:8081/system/setting");//基本设置driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.leftMenu___179-W > ul > li.ant-menu-item.ant-menu-item-selected.ant-menu-item-only-child > span"));//安全设置driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.leftMenu___179-W > ul > li:nth-child(2) > span"));}public void personalStandard() {driver.navigate().refresh();driver.findElement(By.cssSelector("#name")).sendKeys("a");driver.findElement(By.cssSelector("#phone")).sendKeys("12345678909");driver.findElement(By.cssSelector("#email")).sendKeys("123456787@qq.com");driver.findElement(By.cssSelector("#profile")).sendKeys("1");//点击提交driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.right___2jdGg > div.baseView___3sRG3 > div.left___GavW0 > form > div.ant-space.ant-space-horizontal.ant-space-align-center > div:nth-child(2) > button > span")).click();}public void personalPassword() throws InterruptedException {//点击安全设置driver.findElement(By.cssSelector("#sk-layout > div > div > section > div > main > div > div > div > div.leftMenu___179-W > ul > li:nth-child(2) > span")).click();//点击修改driver.findElement(By.cssSelector("#sk-layout > div > div > section > div > main > div > div > div > div.right___2jdGg > div.ant-list.ant-list-split > div > div > ul > li > ul > li > a")).click();//旧密码driver.findElement(By.cssSelector("#oldPassword")).sendKeys("123123");//新密码driver.findElement(By.cssSelector("#password")).sendKeys("123456");//确认密码driver.findElement(By.cssSelector("#confirmPassword")).sendKeys("123456");//点击确认修改driver.findElement(By.cssSelector("body > div:nth-child(9) > div > div.ant-modal-wrap > div > div.ant-modal-content > div.ant-modal-footer > div > div > div:nth-child(2) > button > span")).click();}}

自动化测试全过程:

自动化

四、测试问题

4.1 bug01

标题:我的练习页面习题没做完,习题状态显示已完成

操作步骤

  1. 点击左侧导航栏的"我的练习"
  2. 选择状态为"正在进行"的试题,并点击操作中的"继续作答"
  3. 不做题,直接点击"结束练习"

预期结果

  1. 该练习题进度为0%,状态仍为"正在进行"

实际结果:

  1. 该练习题进度为0%,但状态变更为"已完成"

4.2 bug02

标题:我的题库页面点击导出按钮无响应

操作步骤

  1. 点击左侧导航栏的"我的题库"
  2. 点击该页面的"导出"按钮

预期结果

  1. 题库成功导出

实际结果

  1. 点击"导出"按钮没有任何响应

4.3 bug03

标题:模板广场页面搜索框功能不可用

操作步骤

  1. 点击左侧导航栏的"模板广场"
  2. 在搜索框输入任意已有模板名称
  3. 点击"搜模板"

预期结果

  1. 展示名称匹配的模板

实际结果

  1. 不展示任何模板

4.4 bug04

标题:用户管理页面重置密码无长度限制

操作步骤

  1. 点击左侧导航栏的"用户管理"
  2. 点击用户列表中的"更多"操作并选择出现的"重置密码"
  3. 在"重置密码"输入框中输入长度小于6位的密码
  4. 点击"修改"按钮

预期结果

  1. 点击"修改"后,无响应,并提示"密码长度至少6位"

实际结果

  1. 点击"修改"后,提示:修改成功

4.5 bug05

标题:个人页面修改密码无长度限制

操作步骤

  1. 点击左侧导航栏的"个人设置"
  2. 点击"安全设置"
  3. 点击"修改"
  4. 输入旧密码,新密码(长度小于6位),确认密码
  5. 点击"确认修改"

预期结果

  1. 点击"确认修改"后,无响应,并提示"密码长度至少6位"

实际结果

  1. 点击"修改"后,提示:密码修改成功

五、测试总结

问卷考试系统测试完毕,本次测试覆盖所有页面,核心功能可正常使用,部分功能存在缺陷,如:模板广场页面搜索框不可用、我的题库页面点击导出按钮无响应等;本次测试包括测试用例的编写、功能测试、自动化测试脚本的编写,功能测试过程中,通过手工执行用例完成,自动化测试方面,基于Selenium完成核心流程脚本开发,实现登录等各个页面的自动化回归测试,测试周期为3天

通过本次测试发现,项目还需要针对部分功能进行优化,自动化测试脚本的执行效率方面也需要优化和改进,本人通过此次测试积累了一定的测试经验,未来也会持续的学习测试相关知识

http://www.dtcms.com/a/328331.html

相关文章:

  • Unity UnityWebRequest常用操作
  • 从100到0.3美元:GPT-5用价格战血洗大模型赛道
  • 达梦数据闪回查询-快速恢复表
  • string 类元素访问方法
  • 《嵌入式Linux应用编程(四):Linux文件IO系统调用深度解析》
  • Origin2025b安装包免费,附Origin 2025安装教程
  • 智能机器人学习:智能机器人环境感知传感器介绍
  • 一个基于 PyTorch 的完整模型训练流程
  • 项目里程碑工具选型指南:16款优质系统
  • 基恩士3D视觉用于ABB机器人的KeyenceRobotVisionSetup.sys系统模块程序解析(九、KeyAbsMove)
  • 远程桌面环境协议对比
  • DDIA第五章:无主复制(去中心化复制)详解
  • 【Python办公】Mermaid代码转图片工具 - Tkinter GUI版本
  • wordpress数据库文件sql导入时出现#1253错误
  • 如何通过数据驱动需求决策
  • ZKmall开源商城的容灾之道:多地域部署与故障切换如何守护电商系统
  • Baumer高防护相机如何通过YoloV8深度学习模型实现木板表面缺陷的检测识别(C#代码UI界面版)
  • [java八股文][Mysql面试篇]架构
  • 构建Eclipse Rcp产品的核心文档帮助系统
  • C语言栈的实现
  • 如何追踪需求状态变化
  • Ubuntu Server系统安装磁盘分区方案
  • 文件操作:文件IO操作流程及各类函数应用+标准IO与文件IO区别
  • Sentinel原理之规则管理
  • 力反馈手套让虚拟培训更加真实
  • GitHub的简单使用方法----(5)
  • AR眼镜新赛道:光波导与MicroOLED如何解决眩晕难题?
  • 低空智航平台技术架构深度解析:如何用AI +空域网格破解黑飞与安全管控难题
  • Ceph数据副本机制详解
  • 【编程实践】关于Vscode无法连接Anaconda解译器的问题