mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 03:58:33 +08:00
test(接口测试): 添加Socket消息推送测试用例
This commit is contained in:
parent
ee4d3a7d49
commit
27921050a4
@ -6,6 +6,7 @@ import io.metersphere.sdk.util.JSON;
|
||||
import jakarta.websocket.RemoteEndpoint;
|
||||
import jakarta.websocket.Session;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.mockito.InjectMocks;
|
||||
@ -32,6 +33,7 @@ public class WebSocketHandlerTest {
|
||||
private WebSocketHandler webSocketHandler;
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
void testOpenSession() throws IOException {
|
||||
// 模拟参数
|
||||
String reportId = "123";
|
||||
@ -46,6 +48,7 @@ public class WebSocketHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
void testOnMessage() {
|
||||
// 模拟参数
|
||||
String reportId = "123";
|
||||
@ -60,6 +63,17 @@ public class WebSocketHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
void testOnHeartbeatCheck() throws IOException {
|
||||
// 模拟参数
|
||||
when(session.getAsyncRemote()).thenReturn(async);
|
||||
|
||||
// 调用被测试方法
|
||||
webSocketHandler.heartbeatCheck();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
void testOnClose() throws IOException {
|
||||
// 模拟参数
|
||||
String reportId = "123";
|
||||
@ -73,6 +87,7 @@ public class WebSocketHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(5)
|
||||
void testOnError() throws IOException {
|
||||
// 模拟参数
|
||||
when(session.getAsyncRemote()).thenReturn(async);
|
||||
|
2
pom.xml
2
pom.xml
@ -28,7 +28,7 @@
|
||||
<guava.version>32.0.1-jre</guava.version>
|
||||
<pagehelper.version>6.0.0</pagehelper.version>
|
||||
<metersphere-jmeter-functions.version>3.0</metersphere-jmeter-functions.version>
|
||||
<metersphere-jmeter-assertions.version>1.0.0</metersphere-jmeter-assertions.version>
|
||||
<metersphere-jmeter-assertions.version>1.0.1</metersphere-jmeter-assertions.version>
|
||||
<quartz-starter.version>1.0.7</quartz-starter.version>
|
||||
<redisson-starter.version>3.25.2</redisson-starter.version>
|
||||
<guice.version>5.1.0</guice.version>
|
||||
|
Loading…
Reference in New Issue
Block a user