系统介绍
网页整体采用css技术,盒子模型,边框设计,列表,超链接,表格表单,控件,浮动定位布局,导入音频和简单的JavaScript等技术复原了一个相对完整且美观的LOL游戏官网。
主要有以下功能:
(1)运用导航栏切换其他页面插入了一段与LOL相关的图片,运用盒子,浮动等实现了部分文字部分的布局,同时插入了控件注册按钮,实现账号页面的切换。插入超链接实现点入论坛页面。运用按钮和文字插入超链接实现更多资料页面的切换,运用JavaScript实现截图的自动轮播。最后,在业末加入了相关图片及文字,实现主页网页的设计。
(2)在原本网页背景下在主页,角色介绍,精彩集锦,游戏资讯,游戏简介,召唤师登录加入超链接实现网页切换。同时,通过video元素插入游戏内精彩视频。
(3)在原本网页背景下在主页,角色介绍,精彩集锦,游戏资讯,游戏简介,召唤师登录加入超链接实现网页切换。同时,在召唤师登录页面中插入一张图片。通过表单等实现账号注册的页面。最后,加入了相关css实现以任意账号的验证。
界面截图
主页面:
视频页面:
注册登录页面:
测试用例:
功能测试:
界面测试:
接口测试:
其他测试:
接口测试:
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.response.Response;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static io.restassured.RestAssured.given;
import static org.testng.Assert.assertEquals;
//注册接口测试
public class RegistrationAPITest {
private static final String BASE_URL = "http://localhost:3000";
private static final String REGISTER_ENDPOINT = "/register";
public void setup() {
RestAssured.baseURI = BASE_URL;
}
// 测试成功注册的情况
public void testSuccessfulRegistration() {
Response response = given()
.contentType(ContentType.URLENC)
.formParam("username", "testuser")
.formParam("email", "test@example.com")
.formParam("password", "password123")
.formParam("confirmPassword", "password123")
.post(REGISTER_ENDPOINT);
assertEquals(response.getStatusCode(), 200);
assertEquals(response.getBody().asString(), "Registration successful");
}
// 测试密码不匹配的情况
public void testPasswordMismatch() {
Response response = given()
.contentType(ContentType.URLENC)
.formParam("username", "testuser")
.formParam("email", "test@example.com")
.formParam("password", "password123")
.formParam("confirmPassword", "password456")
.post(REGISTER_ENDPOINT);
assertEquals(response.getStatusCode(), 400);
assertEquals(response.getBody().asString(), "Passwords do not match");
}
// 测试用户名重复的情况
public void testDuplicateUsername() {
Response response = given()
.contentType(ContentType.URLENC)
.formParam("username", "testuser")
.formParam("email", "newuser@example.com")
.formParam("password", "newpassword123")
.formParam("confirmPassword", "newpassword123")
.post(REGISTER_ENDPOINT);
assertEquals(response.getStatusCode(), 400);
assertEquals(response.getBody().asString(), "Username already exists");
}
// 测试邮箱重复的情况
public void testDuplicateEmail() {
Response response = given()
.contentType(ContentType.URLENC)
.formParam("username", "newuser")
.formParam("email", "test@example.com")
.formParam("password", "newpassword123")
.formParam("confirmPassword", "newpassword123")
.post(REGISTER_ENDPOINT);
assertEquals(response.getStatusCode(), 400);
assertEquals(response.getBody().asString(), "Email already exists");
}
}