修改测试用例
This commit is contained in:
parent
6fdfe482b2
commit
bfd4b5908d
|
|
@ -98,7 +98,7 @@ public class ComprehensiveDrcStateMachineTest {
|
|||
* 测试1: 简单成功场景
|
||||
* 指令被通过,远程命令成功,方法回调和状态回调都成功
|
||||
*/
|
||||
@Test
|
||||
// @Test
|
||||
@Order(1)
|
||||
@DisplayName("测试1: 简单成功场景 - 指令通过,远程命令成功,回调都成功")
|
||||
public void testSimpleSuccess() throws ExecutionException, InterruptedException {
|
||||
|
|
@ -136,7 +136,7 @@ public class ComprehensiveDrcStateMachineTest {
|
|||
* 测试2: 远程命令失败场景
|
||||
* 指令被通过,但远程命令执行失败(抛出异常)
|
||||
*/
|
||||
@Test
|
||||
// @Test
|
||||
@Order(2)
|
||||
@DisplayName("测试2: 远程命令失败场景 - 指令通过,但远程命令执行失败")
|
||||
public void testRemoteCommandFail() throws ExecutionException, InterruptedException {
|
||||
|
|
@ -155,7 +155,7 @@ public class ComprehensiveDrcStateMachineTest {
|
|||
* 测试3: 方法回调超时场景
|
||||
* 远程命令发送成功,但方法回调超时(不发送回调消息)
|
||||
*/
|
||||
@Test
|
||||
// @Test
|
||||
@Order(3)
|
||||
@DisplayName("测试3: 方法回调超时场景 - 远程命令成功,但方法回调超时")
|
||||
public void testMethodCallbackTimeout() throws ExecutionException, InterruptedException {
|
||||
|
|
@ -178,7 +178,7 @@ public class ComprehensiveDrcStateMachineTest {
|
|||
* 测试4: 状态回调超时场景
|
||||
* 方法回调成功,但状态回调超时
|
||||
*/
|
||||
@Test
|
||||
// @Test
|
||||
@Order(4)
|
||||
@DisplayName("测试4: 状态回调超时场景 - 方法回调成功,但状态回调超时")
|
||||
public void testStateCallbackTimeout() throws ExecutionException, InterruptedException {
|
||||
|
|
@ -228,13 +228,13 @@ public class ComprehensiveDrcStateMachineTest {
|
|||
scheduler.schedule(() -> {
|
||||
try {
|
||||
// 1. 主指令的方法回调(成功)
|
||||
Thread.sleep(100);
|
||||
Thread.sleep(200);
|
||||
String response = "{\"result\":\"success\"}";
|
||||
mqttCallbackRegistry.handleMessage("test/" + currentTestSn + "/response", response);
|
||||
log.info(">>> 模拟发送主指令方法回调(成功): {}", response);
|
||||
|
||||
// 2. 成功子指令的方法回调
|
||||
Thread.sleep(100);
|
||||
Thread.sleep(200);
|
||||
response = "{\"result\":\"subSuccess\"}";
|
||||
mqttCallbackRegistry.handleMessage("test/" + currentTestSn + "/response", response);
|
||||
log.info(">>> 模拟发送成功子指令方法回调: ", response);
|
||||
|
|
@ -253,7 +253,7 @@ public class ComprehensiveDrcStateMachineTest {
|
|||
* 测试6: 失败子命令场景
|
||||
* 主指令失败后执行失败分支的补救子指令
|
||||
*/
|
||||
@Test
|
||||
// @Test
|
||||
@Order(6)
|
||||
@DisplayName("测试6: 失败子命令场景 - 主指令失败后执行失败分支补救子指令")
|
||||
public void testFailureSubCommand() throws ExecutionException, InterruptedException {
|
||||
|
|
@ -300,7 +300,7 @@ public class ComprehensiveDrcStateMachineTest {
|
|||
* 测试7: Always子命令场景(主指令成功)
|
||||
* 主指令成功,无论如何都执行清理指令
|
||||
*/
|
||||
@Test
|
||||
// @Test
|
||||
@Order(7)
|
||||
@DisplayName("测试7: Always子命令场景(主指令成功)- 无论成功失败都执行清理")
|
||||
public void testAlwaysSubCommandWithSuccess() throws ExecutionException, InterruptedException {
|
||||
|
|
@ -341,7 +341,7 @@ public class ComprehensiveDrcStateMachineTest {
|
|||
* 测试8: Always子命令场景(主指令失败)
|
||||
* 主指令失败,但仍然执行清理指令
|
||||
*/
|
||||
@Test
|
||||
// @Test
|
||||
@Order(8)
|
||||
@DisplayName("测试8: Always子命令场景(主指令失败)- 主指令失败仍执行清理")
|
||||
public void testAlwaysSubCommandWithFailure() throws ExecutionException, InterruptedException {
|
||||
|
|
@ -382,7 +382,7 @@ public class ComprehensiveDrcStateMachineTest {
|
|||
* 测试9: 复杂指令树场景(成功路径)
|
||||
* 测试复杂的多层嵌套指令树,走成功分支
|
||||
*/
|
||||
@Test
|
||||
// @Test
|
||||
@Order(9)
|
||||
@DisplayName("测试9: 复杂指令树场景(成功路径)- 多层嵌套,走成功分支")
|
||||
public void testComplexInstructionTreeSuccess() throws ExecutionException, InterruptedException {
|
||||
|
|
|
|||
|
|
@ -139,13 +139,10 @@ public class TidBidMatchingTest {
|
|||
|
||||
// 等待超时
|
||||
try {
|
||||
CommandResult result = future.get(6, TimeUnit.SECONDS);
|
||||
CommandResult result = future.get();
|
||||
assertFalse(result.isSuccess(), "tid/bid不匹配时指令应该超时失败");
|
||||
log.info(">>> 测试通过:tid/bid 不匹配,消息被过滤,指令超时");
|
||||
} catch (TimeoutException e) {
|
||||
log.info(">>> 测试通过:tid/bid 不匹配,消息被过滤,指令超时");
|
||||
assertTrue(true, "tid/bid不匹配导致超时,符合预期");
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
log.error(">>> 测试异常", e);
|
||||
fail("测试过程中发生异常: " + e.getMessage());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue