一.项目介绍
本项目是一个基于微服务架构的在线 OJ 评测系统,借助 Spring Cloud、SpringMVC、MyBatis 等技术构建,拥有 B 端管理员后台和C 端用户前台。B 端支持管理员对系统全面管理,如题目增删改、用户权限管理、竞赛创建与发布等;C 端为用户提供题目与竞赛浏览、答题、竞赛报名等功能,未登录时部分功能受限,登录后可享受完整服务。系统还运用 Redis、ElasticSearch 等技术提升性能与用户体验,同时集成阿里云短信 服务、OSS 存储等实现实用功能。
二、项目功能
管理员功能:可以进行对用户权限设置(拉黑,正常),对题目的管理(增删改),对竞赛的管理(增删改)
登录用户功能:可以进行个人信息的一个填写(名称,年龄,邮箱,性别,图片上传,学习等等)
可以进行题目的搜索 难易程度 进行刷题
可以参加竞赛 根据时间的选择 参加竞赛后根据提交的题目可以得出当前的排名情况
未登录用户功能:只能进行浏览题目 浏览竞赛 不得进行写题操作

核心功能测试用例(持续更新)
用户登录测试 ,拉黑,搜索题目 ......
package OjTest;
import common.Utils;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.time.Duration;
public class LoginTest extends Utils {
public static String url = "http://81.70.80.96:10030/oj/login";
public LoginTest() {
super(url);
}
public void loginSuc() throws InterruptedException {
//通过cssSelector定位会失败 每次访问都会变 所有使用XPATH定位到父元素 再通过text定位到子元素
driver.findElement(By.xpath("//*[@id=\"app\"]/div/div[4]/div[2]/div[1]/div/div/input")).sendKeys("admin");
driver.findElement(By.xpath("//*[@id=\"app\"]/div/div[4]/div[2]/div[2]/div/div/input")).sendKeys("admin");
//成功登录
driver.findElement(By.cssSelector("#app > div > div.login-box > div.form-box > div.submit-box")).click();
Thread.sleep(1000);
boolean equals = driver.getCurrentUrl().equals("http://81.70.80.96:10030/oj/layout/question");
if(!equals) {
System.out.println("登录失败");
}
//跳转到用户列表中
driver.get("http://81.70.80.96:10030/oj/layout/cuser");
/* //显式等待
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.until(ExpectedConditions.presenceOfElementLocated
(By.xpath("//*[@id=\"el-id-1958-0\"]/div/strong")));*/
}
public void forbidUser() throws InterruptedException {
//拉黑成功
driver.findElement(By.xpath("//*[@id=\"app\"]/section/main/div[2]/div[1]/div[1]/div[3]/div/div[1]/div/table/tbody/tr[1]/td[10]/div/button/span")).click();
//显式等待
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
//看看是否 是 “解禁”
wait.until(ExpectedConditions.presenceOfElementLocated
(By.xpath("//*[@id=\"app\"]/section/main/div[2]/div[1]/div[1]/div[3]/div/div[1]/div/table/tbody/tr[1]/td[10]/div/button/span")));
//解禁
driver.findElement(By.xpath("//*[@id=\"app\"]/section/main/div[2]/div[1]/div[1]/div[3]/div/div[1]/div/table/tbody/tr[1]/td[10]/div/button/span")).click();
}
public void questionEdit() {
driver.get("http://81.70.80.96:10030/oj/layout/question");
String key = "两数之和";
//搜索框中搜索俩数之和
driver.findElement(By.xpath("//*[@id=\"app\"]/section/main/div[2]/form/div[2]/div/div/div/input")).sendKeys("两数之和");
driver.findElement(By.xpath("//*[@id=\"app\"]/section/main/div[2]/form/div[3]/div/button[1]/span")).click();
//重置
driver.findElement(By.xpath("//*[@id=\"app\"]/section/main/div[2]/form/div[3]/div/button[2]/span")).click();
/* System.out.println(1);
//点击 编辑
driver.findElement(By.xpath("//*[@id=\"app\"]/section/main/div[2]/div[1]/div[1]/div[3]/div/div[1]/div/table/tbody/tr[1]/td[6]/div/button[1]/span")).click();
System.out.println(2);*/
/* //弹出框 情况时间限制 修改为10001
driver.findElement(By.xpath("/div/div[1]/div/div[1]/div/div[1)))")).clear();
System.out.println(3);
driver.findElement(By.xpath("/div/div[1]/div/div[1]/div/div[1)))")).sendKeys("10001");
//发布
driver.findElement(By.xpath("//*[@id=\"app\"]/section/main/div[2]/div[3]/div/div/form/div[9]/div/button")).click();*/
}
}
自动化脚本测试:
366




被折叠的 条评论
为什么被折叠?



